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.
This commit is contained in:
Wim Taymans 2009-01-05 17:13:13 +00:00
parent 8632fc5545
commit 0a4c1bc64c
2 changed files with 21 additions and 16 deletions

View file

@ -1,3 +1,12 @@
2009-01-05 Wim Taymans <wim.taymans@collabora.co.uk>
* 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 <wim.taymans@collabora.co.uk>
* gst/playback/gstplaybin2.c: (notify_source_cb), (activate_group):

View file

@ -1709,18 +1709,6 @@ gst_base_audio_sink_async_play (GstBaseSink * basesink)
return GST_STATE_CHANGE_SUCCESS;
}
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;