From cb0ba2db97ee509f91e39dd0cde571c3322f13ea Mon Sep 17 00:00:00 2001 From: Guenter Bartsch Date: Tue, 4 Sep 2001 16:19:27 +0000 Subject: race condition / stability fixes provided by Miguel Freitas - great stuff\! :-) CVS patchset: 562 CVS date: 2001/09/04 16:19:27 --- src/demuxers/demux_avi.c | 4 +++- src/demuxers/demux_elem.c | 8 ++++---- src/demuxers/demux_mpeg.c | 5 +++-- src/demuxers/demux_mpeg_block.c | 4 +++- src/demuxers/demux_mpgaudio.c | 4 +++- src/demuxers/demux_pes.c | 4 +++- src/demuxers/demux_ts.c | 4 +++- src/xine-engine/metronom.c | 14 +++++++++----- 8 files changed, 31 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux_avi.c b/src/demuxers/demux_avi.c index a2e156ca4..737681df8 100644 --- a/src/demuxers/demux_avi.c +++ b/src/demuxers/demux_avi.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: demux_avi.c,v 1.33 2001/09/02 22:26:54 guenter Exp $ + * $Id: demux_avi.c,v 1.34 2001/09/04 16:19:27 guenter Exp $ * * demultiplexer for avi streams * @@ -808,6 +808,7 @@ static void demux_avi_stop (demux_plugin_t *this_gen) { demux_avi_t *this = (demux_avi_t *) this_gen; buf_element_t *buf; + void *p; if (this->status != DEMUX_OK) { printf ("demux_avi: stop...ignored\n"); @@ -818,6 +819,7 @@ static void demux_avi_stop (demux_plugin_t *this_gen) { this->status = DEMUX_FINISHED; pthread_cancel (this->thread); + pthread_join (this->thread, &p); AVI_close (this->avi); this->avi = NULL; diff --git a/src/demuxers/demux_elem.c b/src/demuxers/demux_elem.c index ddf0f4290..8bfad002c 100644 --- a/src/demuxers/demux_elem.c +++ b/src/demuxers/demux_elem.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: demux_elem.c,v 1.17 2001/09/01 14:33:00 guenter Exp $ + * $Id: demux_elem.c,v 1.18 2001/09/04 16:19:27 guenter Exp $ * * demultiplexer for elementary mpeg streams * @@ -135,12 +135,13 @@ static void demux_mpeg_elem_stop (demux_plugin_t *this_gen) { demux_mpeg_elem_t *this = (demux_mpeg_elem_t *) this_gen; buf_element_t *buf = NULL; - + void *p; this->send_end_buffers = 0; this->status = DEMUX_FINISHED; pthread_cancel (this->thread); + pthread_join (this->thread, &p); this->video_fifo->clear(this->video_fifo); if (this->audio_fifo) @@ -306,8 +307,7 @@ static void demux_mpeg_elem_close (demux_plugin_t *this) { /* nothing */ } -static int demux_mpeg_elem_get_stream_length(demux_plugin_t *this_gen, - input_plugin_t *input, int stage) { +static int demux_mpeg_elem_get_stream_length(demux_plugin_t *this_gen) { return 0 ; /*FIXME: implement */ } /* diff --git a/src/demuxers/demux_mpeg.c b/src/demuxers/demux_mpeg.c index 5d57236e3..8974680cd 100644 --- a/src/demuxers/demux_mpeg.c +++ b/src/demuxers/demux_mpeg.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: demux_mpeg.c,v 1.33 2001/09/02 16:19:44 guenter Exp $ + * $Id: demux_mpeg.c,v 1.34 2001/09/04 16:19:27 guenter Exp $ * * demultiplexer for mpeg 1/2 program streams * reads streams of variable blocksizes @@ -611,6 +611,7 @@ static void demux_mpeg_stop (demux_plugin_t *this_gen) { demux_mpeg_t *this = (demux_mpeg_t *) this_gen; buf_element_t *buf; + void *p; printf ("demux_mpeg: stop...\n"); @@ -627,7 +628,7 @@ static void demux_mpeg_stop (demux_plugin_t *this_gen) { this->status = DEMUX_FINISHED; pthread_cancel (this->thread); - /*pthread_join (this->thread, &p);*/ + pthread_join (this->thread, &p); this->video_fifo->clear(this->video_fifo); if(this->audio_fifo) diff --git a/src/demuxers/demux_mpeg_block.c b/src/demuxers/demux_mpeg_block.c index ab11c36d4..82e58da4f 100644 --- a/src/demuxers/demux_mpeg_block.c +++ b/src/demuxers/demux_mpeg_block.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: demux_mpeg_block.c,v 1.37 2001/09/03 17:47:41 guenter Exp $ + * $Id: demux_mpeg_block.c,v 1.38 2001/09/04 16:19:27 guenter Exp $ * * demultiplexer for mpeg 1/2 program streams * @@ -580,6 +580,7 @@ static void demux_mpeg_block_stop (demux_plugin_t *this_gen) { demux_mpeg_block_t *this = (demux_mpeg_block_t *) this_gen; buf_element_t *buf; + void *p; if (this->status != DEMUX_OK) { printf ("demux_mpeg_block: stop...ignored\n"); @@ -590,6 +591,7 @@ static void demux_mpeg_block_stop (demux_plugin_t *this_gen) { this->status = DEMUX_FINISHED; pthread_cancel (this->thread); + pthread_join (this->thread, &p); this->video_fifo->clear(this->video_fifo); if (this->audio_fifo) diff --git a/src/demuxers/demux_mpgaudio.c b/src/demuxers/demux_mpgaudio.c index fb967cb89..6a220981b 100644 --- a/src/demuxers/demux_mpgaudio.c +++ b/src/demuxers/demux_mpgaudio.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: demux_mpgaudio.c,v 1.17 2001/09/01 14:33:00 guenter Exp $ + * $Id: demux_mpgaudio.c,v 1.18 2001/09/04 16:19:27 guenter Exp $ * * demultiplexer for mpeg audio (i.e. mp3) streams * @@ -141,6 +141,7 @@ static void demux_mpgaudio_stop (demux_plugin_t *this_gen) { demux_mpgaudio_t *this = (demux_mpgaudio_t *) this_gen; buf_element_t *buf; + void *p; if (this->status != DEMUX_OK) { printf ("demux_mpgaudio_block: stop...ignored\n"); @@ -151,6 +152,7 @@ static void demux_mpgaudio_stop (demux_plugin_t *this_gen) { this->status = DEMUX_FINISHED; pthread_cancel (this->thread); + pthread_join (this->thread, &p); this->video_fifo->clear(this->video_fifo); if (this->audio_fifo) diff --git a/src/demuxers/demux_pes.c b/src/demuxers/demux_pes.c index 4f746eb0c..0c5b33fa9 100644 --- a/src/demuxers/demux_pes.c +++ b/src/demuxers/demux_pes.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: demux_pes.c,v 1.6 2001/09/01 14:33:00 guenter Exp $ + * $Id: demux_pes.c,v 1.7 2001/09/04 16:19:27 guenter Exp $ * * demultiplexer for mpeg 2 PES (Packetized Elementary Streams) * reads streams of variable blocksizes @@ -354,6 +354,7 @@ static void demux_pes_stop (demux_plugin_t *this_gen) { demux_pes_t *this = (demux_pes_t *) this_gen; buf_element_t *buf; + void *p; printf ("demux_pes: stop...\n"); @@ -370,6 +371,7 @@ static void demux_pes_stop (demux_plugin_t *this_gen) { this->status = DEMUX_FINISHED; pthread_cancel (this->thread); + pthread_join (this->thread, &p); this->video_fifo->clear(this->video_fifo); if(this->audio_fifo) diff --git a/src/demuxers/demux_ts.c b/src/demuxers/demux_ts.c index 1b022d54a..3766c8af1 100644 --- a/src/demuxers/demux_ts.c +++ b/src/demuxers/demux_ts.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: demux_ts.c,v 1.11 2001/09/01 14:33:00 guenter Exp $ + * $Id: demux_ts.c,v 1.12 2001/09/04 16:19:27 guenter Exp $ * * Demultiplexer for MPEG2 Transport Streams. * @@ -944,6 +944,7 @@ static void demux_ts_stop(demux_plugin_t *this_gen) { demux_ts *this = (demux_ts *)this_gen; buf_element_t *buf; + void *p; printf ("demux_ts: stop...\n"); @@ -958,6 +959,7 @@ static void demux_ts_stop(demux_plugin_t *this_gen) this->status = DEMUX_FINISHED; pthread_cancel (this->thread); + pthread_join (this->thread, &p); this->fifoVideo->clear(this->fifoVideo); if(this->fifoAudio) diff --git a/src/xine-engine/metronom.c b/src/xine-engine/metronom.c index bfe3d5393..098ee1553 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.23 2001/08/28 22:52:57 f1rmb Exp $ + * $Id: metronom.c,v 1.24 2001/09/04 16:19:27 guenter Exp $ */ #ifdef HAVE_CONFIG_H @@ -248,7 +248,8 @@ static void metronom_video_stream_start (metronom_t *this) { this->video_stream_starting = 1; if (this->have_audio) { - while (!this->audio_stream_running) { + /*while (!this->audio_stream_running) {*/ + if (!this->audio_stream_running) { printf ("metronom: waiting for audio to start...\n"); pthread_cond_wait (&this->audio_started, &this->lock); } @@ -278,7 +279,8 @@ static void metronom_video_stream_end (metronom_t *this) { this->video_stream_running = 0; if (this->have_audio) { - while (this->audio_stream_running) { + /* while (this->audio_stream_running) { */ + if (this->audio_stream_running) { printf ("metronom: waiting for audio to end...\n"); pthread_cond_wait (&this->audio_ended, &this->lock); } @@ -314,7 +316,8 @@ static void metronom_audio_stream_start (metronom_t *this) { this->audio_stream_running = 1; this->audio_stream_starting = 1; - while (!this->video_stream_running) { + /*while (!this->video_stream_running) { */ + if (!this->video_stream_running) { printf ("metronom: waiting for video to start...\n"); pthread_cond_wait (&this->video_started, &this->lock); } @@ -341,7 +344,8 @@ static void metronom_audio_stream_end (metronom_t *this) { this->audio_stream_running = 0; - while (this->video_stream_running) { + /* while (this->video_stream_running) { */ + if (this->video_stream_running) { printf ("waiting for video to end...\n"); pthread_cond_wait (&this->video_ended, &this->lock); } -- cgit v1.2.3