summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Ringwald <mringwal@inf.ethz.ch>2008-09-28 17:55:09 +0200
committerMatthias Ringwald <mringwal@inf.ethz.ch>2008-09-28 17:55:09 +0200
commit15b6ed2951acc37eb76037ebb786ab827a2c8031 (patch)
tree29bfdb9a6de551832a79a79d51315634521b157d
parent3afabe6fdbcdac1d26e2621845fadb29e106d87a (diff)
downloadxine-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--ChangeLog1
-rw-r--r--src/xine-utils/utils.c20
2 files changed, 11 insertions, 10 deletions
diff --git a/ChangeLog b/ChangeLog
index 74a2829c0..625146639 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
}