baseaudiosrc: Add src object lock around call to ringbuffer parse caps.

A race was observed between query() and setcaps() where the latter would
change the ringbuffer spec while the former was performing operations
based this data.
This commit is contained in:
Stian Johansen 2011-02-23 10:55:12 +01:00 committed by Sebastian Dröge
parent 63cfa2a50d
commit 0f8edca902

View file

@ -560,14 +560,20 @@ gst_base_audio_src_setcaps (GstBaseSrc * bsrc, GstCaps * caps)
spec->buffer_time = src->buffer_time;
spec->latency_time = src->latency_time;
GST_OBJECT_LOCK (src);
if (!gst_ring_buffer_parse_caps (spec, caps))
{
GST_OBJECT_UNLOCK (src);
goto parse_error;
}
/* calculate suggested segsize and segtotal */
spec->segsize =
spec->rate * spec->bytes_per_sample * spec->latency_time / GST_MSECOND;
spec->segtotal = spec->buffer_time / spec->latency_time;
GST_OBJECT_UNLOCK (src);
GST_DEBUG ("release old ringbuffer");
gst_ring_buffer_release (src->ringbuffer);