diff options
author | Guenter Bartsch <guenter@users.sourceforge.net> | 2001-07-03 21:25:03 +0000 |
---|---|---|
committer | Guenter Bartsch <guenter@users.sourceforge.net> | 2001-07-03 21:25:03 +0000 |
commit | 130a1720469f16ceb52a6e571d15f4c018c5a006 (patch) | |
tree | da5031bf8fd964ca0650b11d507d96b20630154c /src/xine-engine | |
parent | 3090bec802840f658c5dc06fe8e5bd0a620b8628 (diff) | |
download | xine-lib-130a1720469f16ceb52a6e571d15f4c018c5a006.tar.gz xine-lib-130a1720469f16ceb52a6e571d15f4c018c5a006.tar.bz2 |
chasing more races..
CVS patchset: 242
CVS date: 2001/07/03 21:25:03
Diffstat (limited to 'src/xine-engine')
-rw-r--r-- | src/xine-engine/buffer.c | 30 | ||||
-rw-r--r-- | src/xine-engine/metronom.c | 45 | ||||
-rw-r--r-- | src/xine-engine/xine.c | 8 |
3 files changed, 72 insertions, 11 deletions
diff --git a/src/xine-engine/buffer.c b/src/xine-engine/buffer.c index 6ad5d9f4d..a05660fb2 100644 --- a/src/xine-engine/buffer.c +++ b/src/xine-engine/buffer.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: buffer.c,v 1.4 2001/05/24 15:31:31 guenter Exp $ + * $Id: buffer.c,v 1.5 2001/07/03 21:25:04 guenter Exp $ * * * contents: @@ -130,10 +130,35 @@ static buf_element_t *fifo_buffer_get (fifo_buffer_t *fifo) { */ static void fifo_buffer_clear (fifo_buffer_t *fifo) { - buf_element_t *buf; + buf_element_t *buf, *next, *prev; pthread_mutex_lock (&fifo->mutex); + buf = fifo->first; + prev = NULL; + + while (buf != NULL) { + + next = buf->next; + + if ((buf->type & BUF_MAJOR_MASK) != BUF_CONTROL_BASE) { + /* remove this buffer */ + + if (prev) + prev->next = next; + else + fifo->first = next; + + if (!next) + fifo->last = prev; + + buf->free_buffer(buf); + } else + prev = buf; + + buf = next; + } + /* while (fifo->first != NULL) { buf = fifo->first; @@ -144,6 +169,7 @@ static void fifo_buffer_clear (fifo_buffer_t *fifo) { buf->free_buffer(buf); } + */ pthread_mutex_unlock (&fifo->mutex); } diff --git a/src/xine-engine/metronom.c b/src/xine-engine/metronom.c index a1c8136d4..de24dad76 100644 --- a/src/xine-engine/metronom.c +++ b/src/xine-engine/metronom.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: metronom.c,v 1.12 2001/06/30 22:53:50 guenter Exp $ + * $Id: metronom.c,v 1.13 2001/07/03 21:25:04 guenter Exp $ */ #ifdef HAVE_CONFIG_H @@ -132,7 +132,13 @@ static void metronom_video_stream_start (metronom_t *this) { pthread_mutex_lock (&this->lock); - printf ("video stream start...\n"); + printf ("metronom: video stream start...\n"); + + if (this->video_stream_running) { + printf ("metronom: video stream start ignored\n"); + pthread_mutex_unlock (&this->lock); + return; + } this->pts_per_frame = 3000; @@ -151,7 +157,7 @@ static void metronom_video_stream_start (metronom_t *this) { if (this->have_audio) { while (!this->audio_stream_running) { - printf ("waiting for audio to start...\n"); + printf ("metronom: waiting for audio to start...\n"); pthread_cond_wait (&this->audio_started, &this->lock); } } @@ -159,7 +165,7 @@ static void metronom_video_stream_start (metronom_t *this) { pthread_mutex_unlock (&this->lock); - printf ("video stream start...done\n"); + printf ("metronom: video stream start...done\n"); metronom_start_clock (this, 0); } @@ -168,11 +174,20 @@ static void metronom_video_stream_start (metronom_t *this) { static void metronom_video_stream_end (metronom_t *this) { pthread_mutex_lock (&this->lock); + + printf ("metronom: video stream end\n"); + + if (!this->video_stream_running) { + printf ("metronom: video stream end ignored\n"); + pthread_mutex_unlock (&this->lock); + return; + } + this->video_stream_running = 0; if (this->have_audio) { while (this->audio_stream_running) { - printf ("waiting for audio to end...\n"); + printf ("metronom: waiting for audio to end...\n"); pthread_cond_wait (&this->audio_ended, &this->lock); } } @@ -186,7 +201,13 @@ static void metronom_audio_stream_start (metronom_t *this) { pthread_mutex_lock (&this->lock); - printf ("audio stream start...\n"); + printf ("metronom: audio stream start...\n"); + + if (this->audio_stream_running) { + printf ("metronom: audio stream start ignored\n"); + pthread_mutex_unlock (&this->lock); + return; + } this->audio_vpts = 0; @@ -202,7 +223,7 @@ static void metronom_audio_stream_start (metronom_t *this) { this->audio_stream_starting = 1; while (!this->video_stream_running) { - printf ("waiting for video to start...\n"); + printf ("metronom: waiting for video to start...\n"); pthread_cond_wait (&this->video_started, &this->lock); } @@ -210,7 +231,7 @@ static void metronom_audio_stream_start (metronom_t *this) { pthread_mutex_unlock (&this->lock); - printf ("audio stream start...done\n"); + printf ("metronom: audio stream start...done\n"); metronom_start_clock (this, 0); } @@ -218,6 +239,14 @@ static void metronom_audio_stream_start (metronom_t *this) { static void metronom_audio_stream_end (metronom_t *this) { pthread_mutex_lock (&this->lock); + + printf ("metronom: audio stream end\n"); + if (!this->audio_stream_running) { + printf ("metronom: audio stream end ignored\n"); + pthread_mutex_unlock (&this->lock); + return; + } + this->audio_stream_running = 0; while (this->video_stream_running) { diff --git a/src/xine-engine/xine.c b/src/xine-engine/xine.c index 542958083..000401caa 100644 --- a/src/xine-engine/xine.c +++ b/src/xine-engine/xine.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: xine.c,v 1.30 2001/06/23 19:45:47 guenter Exp $ + * $Id: xine.c,v 1.31 2001/07/03 21:25:04 guenter Exp $ * * top-level xine functions * @@ -75,17 +75,21 @@ void xine_stop (xine_t *this) { printf ("xine_stop\n"); if (this->status == XINE_STOP) { + printf ("xine_stop ignored\n"); pthread_mutex_unlock (&this->xine_lock); return; } this->status = XINE_STOP; + printf ("xine_stop: stopping demuxer\n"); if(this->cur_demuxer_plugin) { this->cur_demuxer_plugin->stop (this->cur_demuxer_plugin); this->cur_demuxer_plugin = NULL; } + printf ("xine_stop: closing input\n"); + if(this->cur_input_plugin) { this->cur_input_plugin->close(this->cur_input_plugin); this->cur_input_plugin = NULL; @@ -93,6 +97,8 @@ void xine_stop (xine_t *this) { this->spu_fifo->clear(this->spu_fifo); + printf ("xine_stop: done\n"); + pthread_mutex_unlock (&this->xine_lock); } |