From def07410ef5a28a2b541b7ea3d0e998ab88cae64 Mon Sep 17 00:00:00 2001 From: Edward Hervey Date: Tue, 14 Aug 2012 18:53:04 +0200 Subject: [PATCH] audiobasesink: Avoid resetting ringbuffer when not needed If the ringbuffer was configured to the same caps as previously, we don't need to reconfigure it. --- gst-libs/gst/audio/gstaudiobasesink.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/gst-libs/gst/audio/gstaudiobasesink.c b/gst-libs/gst/audio/gstaudiobasesink.c index 6656ce8727..4548fd43cc 100644 --- a/gst-libs/gst/audio/gstaudiobasesink.c +++ b/gst-libs/gst/audio/gstaudiobasesink.c @@ -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