From f0b655e1ad2af1d1d6c1944a63e1b7040c1e0251 Mon Sep 17 00:00:00 2001 From: Jan Schmidt Date: Fri, 3 Jan 2014 02:18:20 +1100 Subject: [PATCH] audiobasesrc: Avoid unnecessary configuration Port a change from audiobasesink from def07410, to ignore setcaps when the caps don't actually change, and avoid a reconfiguration and reset of the ringbuffer in that case. --- gst-libs/gst/audio/gstaudiobasesrc.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/gst-libs/gst/audio/gstaudiobasesrc.c b/gst-libs/gst/audio/gstaudiobasesrc.c index db2f462eca..872116b0fc 100644 --- a/gst-libs/gst/audio/gstaudiobasesrc.c +++ b/gst-libs/gst/audio/gstaudiobasesrc.c @@ -536,11 +536,17 @@ gst_audio_base_src_setcaps (GstBaseSrc * bsrc, GstCaps * caps) GstAudioRingBufferSpec *spec; gint bpf, rate; + spec = &src->ringbuffer->spec; + + if (G_UNLIKELY (spec->caps && gst_caps_is_equal (spec->caps, caps))) { + GST_DEBUG_OBJECT (src, + "Ringbuffer caps haven't changed, skipping reconfiguration"); + return TRUE; + } + GST_DEBUG ("release old ringbuffer"); gst_audio_ring_buffer_release (src->ringbuffer); - spec = &src->ringbuffer->spec; - spec->buffer_time = src->buffer_time; spec->latency_time = src->latency_time;