summaryrefslogtreecommitdiff
path: root/src/xine-engine/video_decoder.c
diff options
context:
space:
mode:
authorMiguel Freitas <miguelfreitas@users.sourceforge.net>2001-10-05 01:56:57 +0000
committerMiguel Freitas <miguelfreitas@users.sourceforge.net>2001-10-05 01:56:57 +0000
commit7079729eb45312aeae2108303bcb3ec85962b3ef (patch)
tree177ac4c7d6c9710ecc54da860e12842ab6082299 /src/xine-engine/video_decoder.c
parent55b8d3f50b253022c61a809f51fe7c68790e1402 (diff)
downloadxine-lib-7079729eb45312aeae2108303bcb3ec85962b3ef.tar.gz
xine-lib-7079729eb45312aeae2108303bcb3ec85962b3ef.tar.bz2
fix a long standing deadlock condition
(in fact it still possible, although very very very difficult to trigger. hint: do a xine_play at the same time the decoders receive end of stream buffers and buffer pool is empty :-) CVS patchset: 735 CVS date: 2001/10/05 01:56:57
Diffstat (limited to 'src/xine-engine/video_decoder.c')
-rw-r--r--src/xine-engine/video_decoder.c31
1 files changed, 15 insertions, 16 deletions
diff --git a/src/xine-engine/video_decoder.c b/src/xine-engine/video_decoder.c
index 5611964ed..d454aae3a 100644
--- a/src/xine-engine/video_decoder.c
+++ b/src/xine-engine/video_decoder.c
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2000-2001 the xine project
- *
+ *
* This file is part of xine, a unix video player.
*
* xine is free software; you can redistribute it and/or modify
@@ -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: video_decoder.c,v 1.53 2001/10/03 17:15:44 jkeil Exp $
+ * $Id: video_decoder.c,v 1.54 2001/10/05 01:56:57 miguelfreitas Exp $
*
*/
@@ -91,11 +91,11 @@ void *video_decoder_loop (void *this_gen) {
this->cur_spu_decoder_plugin = NULL;
}
- pthread_mutex_lock (&this->xine_lock);
+ pthread_mutex_lock (&this->finished_lock);
this->video_finished = 0;
this->spu_finished = 0;
- pthread_mutex_unlock (&this->xine_lock);
+ pthread_mutex_unlock (&this->finished_lock);
this->metronom->video_stream_start (this->metronom);
@@ -144,20 +144,19 @@ void *video_decoder_loop (void *this_gen) {
this->cur_spu_decoder_plugin->close (this->cur_spu_decoder_plugin);
this->cur_spu_decoder_plugin = NULL;
}
+ pthread_mutex_lock (&this->finished_lock);
this->spu_finished = 1;
- pthread_mutex_lock (&this->xine_lock);
-
+
if (!this->video_finished && (buf->decoder_info[0]==0)) {
- this->video_finished = 1;
-
- if (this->audio_finished) {
- pthread_mutex_unlock (&this->xine_lock);
- xine_notify_stream_finished (this);
- } else
- pthread_mutex_unlock (&this->xine_lock);
- } else
- pthread_mutex_unlock (&this->xine_lock);
+ this->video_finished = 1;
+
+ if (this->audio_finished) {
+ xine_notify_stream_finished (this);
+ }
+ }
+
+ pthread_mutex_unlock (&this->finished_lock);
break;
@@ -170,7 +169,7 @@ void *video_decoder_loop (void *this_gen) {
this->cur_spu_decoder_plugin->close (this->cur_spu_decoder_plugin);
this->cur_spu_decoder_plugin = NULL;
}
-
+
running = 0;
break;