audiobasesink: Avoid resetting ringbuffer when not needed
authorEdward Hervey <edward.hervey@collabora.co.uk>
Tue, 14 Aug 2012 16:53:04 +0000 (18:53 +0200)
committerEdward Hervey <edward.hervey@collabora.co.uk>
Tue, 14 Aug 2012 16:56:00 +0000 (18:56 +0200)
If the ringbuffer was configured to the same caps as previously, we
don't need to reconfigure it.

gst-libs/gst/audio/gstaudiobasesink.c

index 6656ce8..4548fd4 100644 (file)
@@ -847,6 +847,12 @@ gst_audio_base_sink_setcaps (GstBaseSink * bsink, GstCaps * caps)
 
   spec = &sink->ringbuffer->spec;
 
+  if (G_UNLIKELY (spec->caps && gst_caps_is_equal (spec->caps, caps))) {
+    GST_DEBUG_OBJECT (sink,
+        "Ringbuffer caps haven't changed, skipping reconfiguration");
+    return TRUE;
+  }
+
   GST_DEBUG_OBJECT (sink, "release old ringbuffer");
 
   /* get current time, updates the last_time. When the subclass has a clock that