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.
This commit is contained in:
Jan Schmidt 2014-01-03 02:18:20 +11:00
parent 472ded1cf3
commit f0b655e1ad

View file

@ -536,11 +536,17 @@ gst_audio_base_src_setcaps (GstBaseSrc * bsrc, GstCaps * caps)
GstAudioRingBufferSpec *spec; GstAudioRingBufferSpec *spec;
gint bpf, rate; 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_DEBUG ("release old ringbuffer");
gst_audio_ring_buffer_release (src->ringbuffer); gst_audio_ring_buffer_release (src->ringbuffer);
spec = &src->ringbuffer->spec;
spec->buffer_time = src->buffer_time; spec->buffer_time = src->buffer_time;
spec->latency_time = src->latency_time; spec->latency_time = src->latency_time;