diff options
author | Matthias Drochner <m.drochner@fz-juelich.de> | 2010-07-21 14:23:25 +0000 |
---|---|---|
committer | Matthias Drochner <m.drochner@fz-juelich.de> | 2010-07-21 14:23:25 +0000 |
commit | 06d09abeaa81336476845e1cc5db2a474ceaa9ad (patch) | |
tree | d16a8bb8a9110c6c799c42f1e30d1e53e12477ea | |
parent | 58c991b313911b85d323ec78a4d6de9a5e022a68 (diff) | |
download | xine-lib-06d09abeaa81336476845e1cc5db2a474ceaa9ad.tar.gz xine-lib-06d09abeaa81336476845e1cc5db2a474ceaa9ad.tar.bz2 |
Normalize timeval
In demux_loop(), a time value is calculated by adding to the fractional
part. In case a second barrier is crossed, the value is not in its
canonical form anymore - the fractional part is larger than 10^9-1.
It should be normalized for portability. While I haven't found a formal
requirement for this in POSIX, NetBSD's libpthread checks for it and
complains.
-rw-r--r-- | src/xine-engine/demux.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/xine-engine/demux.c b/src/xine-engine/demux.c index bbc130988..68fedbcf4 100644 --- a/src/xine-engine/demux.c +++ b/src/xine-engine/demux.c @@ -349,6 +349,10 @@ static void *demux_loop (void *stream_gen) { gettimeofday(&tv, NULL); ts.tv_sec = tv.tv_sec; ts.tv_nsec = (tv.tv_usec + 100000) * 1000; + if (ts.tv_nsec >= 1000000000) { + ts.tv_nsec -= 1000000000; + ts.tv_sec += 1; + } pthread_cond_timedwait (&stream->demux_resume, &stream->demux_lock, &ts); } |