mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 12:11:13 +00:00
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:
parent
63cfa2a50d
commit
0f8edca902
1 changed files with 6 additions and 0 deletions
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue