baseaudiosink: take clock time in setcaps

Take the time of the clock so that the last_time field is set. This is important
for sinks that restart their internal ringbuffer after a caps change and need to
know the last know position.
This commit is contained in:
Wim Taymans 2009-09-09 18:24:44 +02:00
parent 451789735c
commit 06be2b8632

View file

@ -625,6 +625,7 @@ gst_base_audio_sink_setcaps (GstBaseSink * bsink, GstCaps * caps)
{
GstBaseAudioSink *sink = GST_BASE_AUDIO_SINK (bsink);
GstRingBufferSpec *spec;
GstClockTime now;
if (!sink->ringbuffer)
return FALSE;
@ -633,6 +634,11 @@ gst_base_audio_sink_setcaps (GstBaseSink * bsink, GstCaps * caps)
GST_DEBUG_OBJECT (sink, "release old ringbuffer");
/* get current time, updates the last_time */
now = gst_clock_get_time (sink->provided_clock);
GST_DEBUG_OBJECT (sink, "time was %" GST_TIME_FORMAT, GST_TIME_ARGS (now));
/* release old ringbuffer */
gst_ring_buffer_pause (sink->ringbuffer);
gst_ring_buffer_activate (sink->ringbuffer, FALSE);