mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-06 07:28:53 +00:00
baseaudiosrc: protect against ringbuffer disappearing while in a query
Observed a case where the src went to null-state during the query, hence the spec pointer was no longer valid, and gst_util_unit64_scale_int crashed (assertion `denom > 0´failed) Add locking to make sure the ringbuffer can't disappear.
This commit is contained in:
parent
588ac0ae6f
commit
63cfa2a50d
1 changed files with 5 additions and 1 deletions
|
@ -628,9 +628,12 @@ gst_base_audio_src_query (GstBaseSrc * bsrc, GstQuery * query)
|
||||||
GstClockTime min_latency, max_latency;
|
GstClockTime min_latency, max_latency;
|
||||||
GstRingBufferSpec *spec;
|
GstRingBufferSpec *spec;
|
||||||
|
|
||||||
|
GST_OBJECT_LOCK (src);
|
||||||
if (G_UNLIKELY (src->ringbuffer == NULL
|
if (G_UNLIKELY (src->ringbuffer == NULL
|
||||||
|| src->ringbuffer->spec.rate == 0))
|
|| src->ringbuffer->spec.rate == 0)) {
|
||||||
|
GST_OBJECT_UNLOCK (src);
|
||||||
goto done;
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
spec = &src->ringbuffer->spec;
|
spec = &src->ringbuffer->spec;
|
||||||
|
|
||||||
|
@ -642,6 +645,7 @@ gst_base_audio_src_query (GstBaseSrc * bsrc, GstQuery * query)
|
||||||
max_latency =
|
max_latency =
|
||||||
gst_util_uint64_scale_int (spec->segtotal * spec->segsize, GST_SECOND,
|
gst_util_uint64_scale_int (spec->segtotal * spec->segsize, GST_SECOND,
|
||||||
spec->rate * spec->bytes_per_sample);
|
spec->rate * spec->bytes_per_sample);
|
||||||
|
GST_OBJECT_UNLOCK (src);
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (src,
|
GST_DEBUG_OBJECT (src,
|
||||||
"report latency min %" GST_TIME_FORMAT " max %" GST_TIME_FORMAT,
|
"report latency min %" GST_TIME_FORMAT " max %" GST_TIME_FORMAT,
|
||||||
|
|
Loading…
Reference in a new issue