mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-25 11:11:08 +00:00
baseaudiosink: correct for clock reset
When going to NULL, we reset the ringbuffer so that it starts beck from 0. We also make sure that the clock is updated with the elapsed time so that it alsways increments even when the ringbuffer goes back to 0. When this happened we need to adjust the sample position for the reset ringbuffer. Fixes #594136
This commit is contained in:
parent
47550f6984
commit
fe47c6c4d5
1 changed files with 21 additions and 8 deletions
|
@ -1220,6 +1220,7 @@ gst_base_audio_sink_render (GstBaseSink * bsink, GstBuffer * buf)
|
|||
gboolean sync, slaved, align_next;
|
||||
GstFlowReturn ret;
|
||||
GstSegment clip_seg;
|
||||
gint64 time_offset;
|
||||
|
||||
sink = GST_BASE_AUDIO_SINK (bsink);
|
||||
|
||||
|
@ -1401,6 +1402,18 @@ gst_base_audio_sink_render (GstBaseSink * bsink, GstBuffer * buf)
|
|||
&render_start, &render_stop);
|
||||
}
|
||||
|
||||
/* bring to position in the ringbuffer */
|
||||
time_offset =
|
||||
GST_AUDIO_CLOCK_CAST (sink->provided_clock)->abidata.ABI.time_offset;
|
||||
if (render_start > time_offset)
|
||||
render_start -= time_offset;
|
||||
else
|
||||
render_start = 0;
|
||||
if (render_stop > time_offset)
|
||||
render_stop -= time_offset;
|
||||
else
|
||||
render_stop = 0;
|
||||
|
||||
/* and bring the time to the rate corrected offset in the buffer */
|
||||
render_start = gst_util_uint64_scale_int (render_start,
|
||||
ringbuf->spec.rate, GST_SECOND);
|
||||
|
|
Loading…
Reference in a new issue