diff options
author | Jan Schmidt <jan@centricular.com> | 2014-01-03 02:18:20 +1100 |
---|---|---|
committer | Jan Schmidt <jan@centricular.com> | 2014-01-03 02:20:39 +1100 |
commit | f0b655e1ad2af1d1d6c1944a63e1b7040c1e0251 (patch) | |
tree | 6e8070ed1bade0e4c43405d37af99670b1ee46fe | |
parent | 472ded1cf333a35e328a21084f46a28dd5febfef (diff) |
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.
-rw-r--r-- | gst-libs/gst/audio/gstaudiobasesrc.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/gst-libs/gst/audio/gstaudiobasesrc.c b/gst-libs/gst/audio/gstaudiobasesrc.c index db2f462ec..872116b0f 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; |