summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrantišek Dvořák <valtri@users.sourceforge.net>2004-03-23 22:54:31 +0000
committerFrantišek Dvořák <valtri@users.sourceforge.net>2004-03-23 22:54:31 +0000
commit701dd25135865dde571b1286109566ad3d74895f (patch)
tree85913640ae36ed528d3fc354b7d26a98e0690fed
parent7a53c78e7c76c396a534e32fb75952192865ed16 (diff)
downloadxine-lib-701dd25135865dde571b1286109566ad3d74895f.tar.gz
xine-lib-701dd25135865dde571b1286109566ad3d74895f.tar.bz2
Ignore speed change in nbc during xine_stop() to avid deadlocks.
CVS patchset: 6305 CVS date: 2004/03/23 22:54:31
-rw-r--r--src/xine-engine/xine.c15
-rw-r--r--src/xine-engine/xine_internal.h3
2 files changed, 10 insertions, 8 deletions
diff --git a/src/xine-engine/xine.c b/src/xine-engine/xine.c
index e5b26acb3..b18b44c0d 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.285 2004/03/16 20:50:09 mroi Exp $
+ * $Id: xine.c,v 1.286 2004/03/23 22:54:31 valtri Exp $
*/
/*
@@ -255,6 +255,7 @@ static void __set_speed_internal (xine_stream_t *stream, int speed) {
}
+/* stream->ignore_speed_change must be set, when entering this function */
static void __stop_internal (xine_stream_t *stream) {
int finished_count_audio = 0;
@@ -297,12 +298,6 @@ static void __stop_internal (xine_stream_t *stream) {
_x_demux_stop_thread( stream );
lprintf ("stop thread done\n");
- /* set normal speed again (now that demuxer/input pair is suspended)
- * some input plugin may have changed speed by itself, we must ensure
- * the engine is not paused.
- */
- __set_speed_internal (stream, XINE_SPEED_NORMAL);
-
_x_demux_flush_engine( stream );
lprintf ("flush engine done\n");
@@ -329,6 +324,7 @@ void xine_stop (xine_stream_t *stream) {
pthread_mutex_lock (&stream->frontend_lock);
+ stream->ignore_speed_change = 1;
stream->xine->port_ticket->acquire(stream->xine->port_ticket, 1);
if (stream->audio_out)
@@ -347,6 +343,7 @@ void xine_stop (xine_stream_t *stream) {
stream->audio_out->set_property(stream->audio_out, AO_PROP_DISCARD_BUFFERS, 0);
stream->xine->port_ticket->release(stream->xine->port_ticket, 1);
+ stream->ignore_speed_change = 0;
pthread_mutex_unlock (&stream->frontend_lock);
}
@@ -365,7 +362,9 @@ static void __close_internal (xine_stream_t *stream) {
}
}
+ stream->ignore_speed_change = 1;
__stop_internal( stream );
+ stream->ignore_speed_change = 0;
lprintf ("disposing demux\n");
if (stream->demux_plugin) {
@@ -1555,6 +1554,8 @@ int xine_get_status (xine_stream_t *stream) {
void _x_set_speed (xine_stream_t *stream, int speed) {
+ if (stream->ignore_speed_change) return;
+
if (speed <= XINE_SPEED_PAUSE)
speed = XINE_SPEED_PAUSE;
else if (speed > XINE_SPEED_FAST_4)
diff --git a/src/xine-engine/xine_internal.h b/src/xine-engine/xine_internal.h
index 7953fd8cf..7638939e5 100644
--- a/src/xine-engine/xine_internal.h
+++ b/src/xine-engine/xine_internal.h
@@ -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_internal.h,v 1.154 2004/02/12 18:19:00 mroi Exp $
+ * $Id: xine_internal.h,v 1.155 2004/03/23 22:54:32 valtri Exp $
*
*/
@@ -239,6 +239,7 @@ struct xine_stream_s {
/* these are private variables, plugins must not access them */
int status;
+ int ignore_speed_change; /* speed changes during stop can be disastrous */
input_class_t *eject_class;
demux_plugin_t *demux_plugin;