diff options
author | Matthias Ringwald <mringwal@inf.ethz.ch> | 2008-09-28 17:55:09 +0200 |
---|---|---|
committer | Matthias Ringwald <mringwal@inf.ethz.ch> | 2008-09-28 17:55:09 +0200 |
commit | 15b6ed2951acc37eb76037ebb786ab827a2c8031 (patch) | |
tree | 29bfdb9a6de551832a79a79d51315634521b157d | |
parent | 3afabe6fdbcdac1d26e2621845fadb29e106d87a (diff) | |
download | xine-lib-15b6ed2951acc37eb76037ebb786ab827a2c8031.tar.gz xine-lib-15b6ed2951acc37eb76037ebb786ab827a2c8031.tar.bz2 |
Fix xine_usec_sleep for mingw+msys
Bug was found and fixed by Carlo Bramini.
select() does not work on mingw+msys causing xine_usec_sleep to sleep much
longer than requested which completely broke audio playback
-rw-r--r-- | ChangeLog | 1 | ||||
-rw-r--r-- | src/xine-utils/utils.c | 20 |
2 files changed, 11 insertions, 10 deletions
@@ -3,6 +3,7 @@ xine-lib (1.1.16) 2008-??-?? * Fix CDDB access in 64-bit builds. * Fix seeking FLV clips that don't specify the movie length in the headers. * Support H.264 and AAC streams within FLV. + * Fix timing issues (broken audio) on mingw. xine-lib (1.1.15) 2008-08-14 * Security fixes: diff --git a/src/xine-utils/utils.c b/src/xine-utils/utils.c index 57a92623c..689b68502 100644 --- a/src/xine-utils/utils.c +++ b/src/xine-utils/utils.c @@ -456,23 +456,22 @@ char *xine_chomp(char *str) { * a thread-safe usecond sleep */ void xine_usec_sleep(unsigned usec) { -#if 0 -#if HAVE_NANOSLEEP +#ifdef WIN32 + /* select does not work on win32 */ + Sleep(usec / 1000); +#else +# if 0 +# if HAVE_NANOSLEEP /* nanosleep is prefered on solaris, because it's mt-safe */ struct timespec ts, remaining; - ts.tv_sec = usec / 1000000; ts.tv_nsec = (usec % 1000000) * 1000; while (nanosleep (&ts, &remaining) == -1 && errno == EINTR) ts = remaining; -#else -# if WIN32 - Sleep(usec / 1000); -# else +# else usleep(usec); -# endif -#endif -#else +# endif +# else if (usec < 10000) { usec = 10000; } @@ -480,6 +479,7 @@ void xine_usec_sleep(unsigned usec) { tm.tv_sec = usec / 1000000; tm.tv_usec = usec % 1000000; select(0, 0, 0, 0, &tm); +# endif #endif } |