From 0a4c1bc64c7033cb65cfc3f597dab8d4620dcd26 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Mon, 5 Jan 2009 17:13:13 +0000 Subject: [PATCH] gst-libs/gst/audio/gstbaseaudiosink.c: Avoid holding the OBJECT_LOCK when calling ringbuffer functions that take the ... Original commit message from CVS: * gst-libs/gst/audio/gstbaseaudiosink.c: (gst_base_audio_sink_change_state): Avoid holding the OBJECT_LOCK when calling ringbuffer functions that take the ringbuffer lock because rinbuffer lock > OBJECT_LOCK. We can do this because the async_play method is deprecated and usually not called anymore. --- ChangeLog | 9 +++++++++ gst-libs/gst/audio/gstbaseaudiosink.c | 28 ++++++++++++---------------- 2 files changed, 21 insertions(+), 16 deletions(-) diff --git a/ChangeLog b/ChangeLog index 999f366..4512e04 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,14 @@ 2009-01-05 Wim Taymans + * gst-libs/gst/audio/gstbaseaudiosink.c: + (gst_base_audio_sink_change_state): + Avoid holding the OBJECT_LOCK when calling ringbuffer functions that + take the ringbuffer lock because rinbuffer lock > OBJECT_LOCK. We can do + this because the async_play method is deprecated and usually not called + anymore. + +2009-01-05 Wim Taymans + * gst/playback/gstplaybin2.c: (notify_source_cb), (activate_group): Disconnect signal handlers before destroying a previous decodebin so that we don't end up causing deadlocks. Fixes #566586. diff --git a/gst-libs/gst/audio/gstbaseaudiosink.c b/gst-libs/gst/audio/gstbaseaudiosink.c index 7f42d7e..59318ab 100644 --- a/gst-libs/gst/audio/gstbaseaudiosink.c +++ b/gst-libs/gst/audio/gstbaseaudiosink.c @@ -1710,18 +1710,6 @@ gst_base_audio_sink_async_play (GstBaseSink * basesink) } static GstStateChangeReturn -gst_base_audio_sink_do_play (GstBaseAudioSink * sink) -{ - GstStateChangeReturn ret; - - GST_OBJECT_LOCK (sink); - ret = gst_base_audio_sink_async_play (GST_BASE_SINK_CAST (sink)); - GST_OBJECT_UNLOCK (sink); - - return ret; -} - -static GstStateChangeReturn gst_base_audio_sink_change_state (GstElement * element, GstStateChange transition) { @@ -1745,15 +1733,23 @@ gst_base_audio_sink_change_state (GstElement * element, gst_ring_buffer_may_start (sink->ringbuffer, FALSE); break; case GST_STATE_CHANGE_PAUSED_TO_PLAYING: - gst_base_audio_sink_do_play (sink); + GST_OBJECT_LOCK (sink); + GST_DEBUG_OBJECT (sink, "ringbuffer may start now"); + sink->priv->sync_latency = TRUE; + GST_OBJECT_UNLOCK (sink); + + gst_ring_buffer_may_start (sink->ringbuffer, TRUE); + if (GST_BASE_SINK_CAST (sink)->pad_mode == GST_ACTIVATE_PULL) { + /* we always start the ringbuffer in pull mode immediatly */ + gst_ring_buffer_start (sink->ringbuffer); + } break; case GST_STATE_CHANGE_PLAYING_TO_PAUSED: - /* need to take the lock so we don't interfere with an - * async play */ - GST_OBJECT_LOCK (sink); /* ringbuffer cannot start anymore */ gst_ring_buffer_may_start (sink->ringbuffer, FALSE); gst_ring_buffer_pause (sink->ringbuffer); + + GST_OBJECT_LOCK (sink); sink->priv->sync_latency = FALSE; GST_OBJECT_UNLOCK (sink); break; -- 2.7.4