wtay gst-plugins-base: gst-plugins-base/ gst-plugins-base/gst-libs/gst/audio/

[email protected] Mon, 5 Jan 2009 09:13:28 -0800 (PST)
Newsgroups gmane.comp.video.gstreamer.cvs
Message-ID <[email protected]>
CVS Root:       /cvs/gstreamer
Module:         gst-plugins-base
Changes by:     wtay
Date:           Mon Jan 05 2009  17:13:28 UTC

Log message:
* 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.

Modified files:
    .               : ChangeLog
    gst-libs/gst/audio: gstbaseaudiosink.c

Links:
http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-base/ChangeLog.diff?r1=1.4270&r2=1.4271
http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-base/gst-libs/gst/audio/gstbaseaudiosink.c.diff?r1=1.113&r2=1.114

====Begin Diffs====
Index: ChangeLog
===================================================================
RCS file: /cvs/gstreamer/gst-plugins-base/ChangeLog,v
retrieving revision 1.4270
retrieving revision 1.4271
diff -u -d -r1.4270 -r1.4271
--- ChangeLog	5 Jan 2009 12:18:50 -0000	1.4270
+++ ChangeLog	5 Jan 2009 17:13:12 -0000	1.4271
@@ -1,5 +1,14 @@
 2009-01-05  Wim Taymans  <[email protected]>
 
+	* 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  <[email protected]>
 	* 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.
Index: gstbaseaudiosink.c
RCS file: /cvs/gstreamer/gst-plugins-base/gst-libs/gst/audio/gstbaseaudiosink.c,v
retrieving revision 1.113
retrieving revision 1.114
diff -u -d -r1.113 -r1.114
--- gstbaseaudiosink.c	20 Dec 2008 12:45:03 -0000	1.113
+++ gstbaseaudiosink.c	5 Jan 2009 17:13:13 -0000	1.114
@@ -1710,18 +1710,6 @@
 }
 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_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);
+      }
     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_pause (sink->ringbuffer);
       sink->priv->sync_latency = FALSE;
       GST_OBJECT_UNLOCK (sink);

------------------------------------------------------------------------------