summaryrefslogtreecommitdiff
path: root/src/xine-engine/demux.c
diff options
context:
space:
mode:
authorDarren Salt <linux@youmustbejoking.demon.co.uk>2008-03-12 01:08:23 +0000
committerDarren Salt <linux@youmustbejoking.demon.co.uk>2008-03-12 01:08:23 +0000
commitb5887dafca2631646384b089b6ee45dc51c76405 (patch)
tree08e074612cbc06a3c5827cebbac5b41d8852b43c /src/xine-engine/demux.c
parent1c4e2a1b547e26f48b5797edcf54c43ba6f6e213 (diff)
parent08765c20628cd7a38b53871390b91b16f30e8f9c (diff)
downloadxine-lib-b5887dafca2631646384b089b6ee45dc51c76405.tar.gz
xine-lib-b5887dafca2631646384b089b6ee45dc51c76405.tar.bz2
Merge from 1.1.
--HG-- rename : doc/faq/faq.sgml => doc/faq/faq.docbook rename : src/xine-engine/xine_internal.h => include/xine/xine_internal.h rename : src/libffmpeg/Makefile.am => src/combined/ffmpeg/Makefile.am rename : src/demuxers/demux_ogg.c => src/combined/xine_ogg_demuxer.c
Diffstat (limited to 'src/xine-engine/demux.c')
-rw-r--r--src/xine-engine/demux.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/xine-engine/demux.c b/src/xine-engine/demux.c
index 232e0342e..e641bbf77 100644
--- a/src/xine-engine/demux.c
+++ b/src/xine-engine/demux.c
@@ -198,6 +198,7 @@ void _x_demux_control_headers_done (xine_stream_t *stream) {
}
stream->demux_action_pending = 0;
+ pthread_cond_signal(&stream->demux_resume);
lprintf ("headers processed.\n");
@@ -284,12 +285,14 @@ static void *demux_loop (void *stream_gen) {
/* someone may want to interrupt us */
if( stream->demux_action_pending ) {
- pthread_mutex_unlock( &stream->demux_lock );
+ struct timeval tv;
+ struct timespec ts;
- lprintf ("sched_yield\n");
-
- sched_yield();
- pthread_mutex_lock( &stream->demux_lock );
+ gettimeofday(&tv, NULL);
+ ts.tv_sec = tv.tv_sec;
+ ts.tv_nsec = (tv.tv_usec + 100000) * 1000;
+
+ pthread_cond_timedwait (&stream->demux_resume, &stream->demux_lock, &ts);
}
}
@@ -365,6 +368,7 @@ int _x_demux_start_thread (xine_stream_t *stream) {
stream->demux_action_pending = 1;
pthread_mutex_lock( &stream->demux_lock );
stream->demux_action_pending = 0;
+ pthread_cond_signal(&stream->demux_resume);
if( !stream->demux_thread_running ) {
@@ -396,6 +400,7 @@ int _x_demux_stop_thread (xine_stream_t *stream) {
pthread_mutex_lock( &stream->demux_lock );
stream->demux_thread_running = 0;
stream->demux_action_pending = 0;
+ pthread_cond_signal(&stream->demux_resume);
/* At that point, the demuxer has sent the last audio/video buffer,
* so it's a safe place to flush the engine.