From 341edb6593830583adbd69ac96205f69f6d4f0ca Mon Sep 17 00:00:00 2001 From: Thibaut Mattern Date: Fri, 1 Nov 2002 11:15:05 +0000 Subject: Fix seeking at the end of the stream. CVS patchset: 3123 CVS date: 2002/11/01 11:15:05 --- src/xine-engine/demux.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'src/xine-engine/demux.c') diff --git a/src/xine-engine/demux.c b/src/xine-engine/demux.c index f4d7c0679..8990db584 100644 --- a/src/xine-engine/demux.c +++ b/src/xine-engine/demux.c @@ -171,11 +171,12 @@ static void *demux_loop (void *stream_gen) { #ifdef LOG printf ("demux: main demuxer loop finished (status: %d)\n", status); #endif + /* wait before sending end buffers: user might want to do a new seek */ while(stream->demux_thread_running && - (!stream->video_fifo || stream->video_fifo->size(stream->video_fifo)) && - (!stream->audio_fifo || stream->audio_fifo->size(stream->audio_fifo)) && - status != DEMUX_OK ){ + ((!stream->video_fifo || stream->video_fifo->size(stream->video_fifo)) || + (!stream->audio_fifo || stream->audio_fifo->size(stream->audio_fifo))) && + status == DEMUX_FINISHED ){ pthread_mutex_unlock( &stream->demux_lock ); xine_usec_sleep(100000); pthread_mutex_lock( &stream->demux_lock ); @@ -194,12 +195,12 @@ static void *demux_loop (void *stream_gen) { } else { xine_demux_control_end(stream, BUF_FLAG_END_USER); } - + stream->demux_thread_running = 0; + pthread_mutex_unlock( &stream->demux_lock ); - - pthread_exit(NULL); + pthread_exit(NULL); return NULL; } @@ -258,7 +259,7 @@ int xine_demux_stop_thread (xine_stream_t *stream) { stream->demux_thread = 0; pthread_mutex_unlock (&stream->counter_lock); - + /* * Wake up xine_play if it's waiting for a frame */ @@ -268,6 +269,6 @@ int xine_demux_stop_thread (xine_stream_t *stream) { pthread_cond_signal(&stream->first_frame_reached); } pthread_mutex_unlock (&stream->first_frame_lock); - + return 0; } -- cgit v1.2.3