baseaudiosrc: Post clock-provide and clock-lost messages when going from/to PLAYING
authorSebastian Dröge <sebastian.droege@collabora.co.uk>
Fri, 9 Jul 2010 15:15:35 +0000 (17:15 +0200)
committerSebastian Dröge <sebastian.droege@collabora.co.uk>
Fri, 16 Jul 2010 15:40:45 +0000 (17:40 +0200)
gst-libs/gst/audio/gstbaseaudiosrc.c

index df365b8533c2b4366faef74446c54debaf6af150..468402c3a9b578a7e8e2ee3f8ed38eb9deaccf15 100644 (file)
@@ -1080,9 +1080,28 @@ gst_base_audio_src_change_state (GstElement * element,
     case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
       GST_DEBUG_OBJECT (src, "PAUSED->PLAYING");
       gst_ring_buffer_may_start (src->ringbuffer, TRUE);
+
+      /* Only post clock-provide messages if this is the clock that
+       * we've created. If the subclass has overriden it the subclass
+       * should post this messages whenever necessary */
+      if (src->clock && GST_IS_AUDIO_CLOCK (src->clock) &&
+          GST_AUDIO_CLOCK_CAST (src->clock)->func ==
+          (GstAudioClockGetTimeFunc) gst_base_audio_src_get_time)
+        gst_element_post_message (element,
+            gst_message_new_clock_provide (GST_OBJECT_CAST (element),
+                src->clock, TRUE));
       break;
     case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
       GST_DEBUG_OBJECT (src, "PLAYING->PAUSED");
+      /* Only post clock-lost messages if this is the clock that
+       * we've created. If the subclass has overriden it the subclass
+       * should post this messages whenever necessary */
+      if (src->clock && GST_IS_AUDIO_CLOCK (src->clock) &&
+          GST_AUDIO_CLOCK_CAST (src->clock)->func ==
+          (GstAudioClockGetTimeFunc) gst_base_audio_src_get_time)
+        gst_element_post_message (element,
+            gst_message_new_clock_lost (GST_OBJECT_CAST (element), src->clock));
+
       gst_ring_buffer_may_start (src->ringbuffer, FALSE);
       gst_ring_buffer_pause (src->ringbuffer);
       break;