baseaudiosink: take clock time in setcaps
authorWim Taymans <wim.taymans@collabora.co.uk>
Wed, 9 Sep 2009 16:24:44 +0000 (18:24 +0200)
committerWim Taymans <wim.taymans@collabora.co.uk>
Wed, 9 Sep 2009 16:26:03 +0000 (18:26 +0200)
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.

gst-libs/gst/audio/gstbaseaudiosink.c

index 5c6a959..afa62c3 100644 (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);