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:
Wim Taymans 2009-09-09 16:19:32 +02:00
parent 47550f6984
commit fe47c6c4d5

View file

@ -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);