Commit 0f8edca9 authored by Stian Johansen's avatar Stian Johansen Committed by Sebastian Dröge
Browse files

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.
parent 63cfa2a5
...@@ -560,14 +560,20 @@ gst_base_audio_src_setcaps (GstBaseSrc * bsrc, GstCaps * caps) ...@@ -560,14 +560,20 @@ gst_base_audio_src_setcaps (GstBaseSrc * bsrc, GstCaps * caps)
spec->buffer_time = src->buffer_time; spec->buffer_time = src->buffer_time;
spec->latency_time = src->latency_time; spec->latency_time = src->latency_time;
if (!gst_ring_buffer_parse_caps (spec, caps)) if (!gst_ring_buffer_parse_caps (spec, caps))
goto parse_error; goto parse_error;
/* calculate suggested segsize and segtotal */ /* calculate suggested segsize and segtotal */
spec->segsize = spec->segsize =
spec->rate * spec->bytes_per_sample * spec->latency_time / GST_MSECOND; spec->rate * spec->bytes_per_sample * spec->latency_time / GST_MSECOND;
spec->segtotal = spec->buffer_time / spec->latency_time; spec->segtotal = spec->buffer_time / spec->latency_time;
GST_DEBUG ("release old ringbuffer"); GST_DEBUG ("release old ringbuffer");
gst_ring_buffer_release (src->ringbuffer); gst_ring_buffer_release (src->ringbuffer);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment