gst-libs/gst/audio/gstbaseaudiosink.c: Set ringbuffer to non-flushing when going...
authorWim Taymans <wim.taymans@gmail.com>
Wed, 16 Nov 2005 16:48:35 +0000 (16:48 +0000)
committerWim Taymans <wim.taymans@gmail.com>
Wed, 16 Nov 2005 16:48:35 +0000 (16:48 +0000)
Original commit message from CVS:
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_base_audio_sink_provide_clock),
(gst_base_audio_sink_change_state):
Set ringbuffer to non-flushing when going to PAUSED, set to
flushing again when going to READY.

* gst-libs/gst/audio/gstringbuffer.c: (gst_ring_buffer_init),
(gst_ring_buffer_stop):
Start in flushing mode by default.
Don't set flushing in the _stop method, let the app call
this explicitly.

ChangeLog
gst-libs/gst/audio/gstbaseaudiosink.c
gst-libs/gst/audio/gstringbuffer.c

index 9284212bb1972bcc4219e952cc96b2c6422e427f..c8bbaf24d39e4be5b84e54df6dd6fa1321256a50 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2005-11-16  Wim Taymans  <wim@fluendo.com>
+
+       * gst-libs/gst/audio/gstbaseaudiosink.c:
+       (gst_base_audio_sink_provide_clock),
+       (gst_base_audio_sink_change_state):
+       Set ringbuffer to non-flushing when going to PAUSED, set to
+       flushing again when going to READY.
+
+       * gst-libs/gst/audio/gstringbuffer.c: (gst_ring_buffer_init),
+       (gst_ring_buffer_stop):
+       Start in flushing mode by default.
+       Don't set flushing in the _stop method, let the app call
+       this explicitly.
+
 2005-11-16  Julien MOUTTE  <julien@moutte.net>
 
        * gst-libs/gst/video/gstvideosink.c: (gst_video_sink_center_rect):
index 947915e389182d08a544890137b9aa3d524d599c..032e003535765b0f3a6fb376541fce84267c6e41 100644 (file)
@@ -162,10 +162,17 @@ static GstClock *
 gst_base_audio_sink_provide_clock (GstElement * elem)
 {
   GstBaseAudioSink *sink;
+  GstClock *clock;
 
   sink = GST_BASE_AUDIO_SINK (elem);
 
-  return GST_CLOCK (gst_object_ref (sink->clock));
+#if 1
+  clock = GST_CLOCK_CAST (gst_object_ref (sink->clock));
+#else
+  clock = gst_system_clock_obtain ();
+#endif
+
+  return clock;
 }
 
 static GstClockTime
@@ -534,6 +541,7 @@ gst_base_audio_sink_change_state (GstElement * element,
       sink->next_sample = 0;
       break;
     case GST_STATE_CHANGE_READY_TO_PAUSED:
+      gst_ring_buffer_set_flushing (sink->ringbuffer, FALSE);
       break;
     case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
       break;
@@ -548,9 +556,10 @@ gst_base_audio_sink_change_state (GstElement * element,
       gst_ring_buffer_pause (sink->ringbuffer);
       break;
     case GST_STATE_CHANGE_PAUSED_TO_READY:
+      gst_ring_buffer_set_flushing (sink->ringbuffer, TRUE);
       gst_ring_buffer_stop (sink->ringbuffer);
-      gst_pad_set_caps (GST_BASE_SINK_PAD (sink), NULL);
       gst_ring_buffer_release (sink->ringbuffer);
+      gst_pad_set_caps (GST_BASE_SINK_PAD (sink), NULL);
       break;
     case GST_STATE_CHANGE_READY_TO_NULL:
       gst_ring_buffer_close_device (sink->ringbuffer);
index 8e38e8a971ca4b6b63ac6d13e52306118da533db..5083bda9d18a99170b7bca4a991810525c624578 100644 (file)
@@ -88,6 +88,7 @@ gst_ring_buffer_init (GstRingBuffer * ringbuffer)
   ringbuffer->cond = g_cond_new ();
   ringbuffer->waiting = 0;
   ringbuffer->empty_seg = NULL;
+  ringbuffer->flushing = TRUE;
 }
 
 static void
@@ -796,7 +797,6 @@ gst_ring_buffer_stop (GstRingBuffer * buf)
   GST_DEBUG_OBJECT (buf, "stopping");
 
   GST_LOCK (buf);
-  buf->flushing = TRUE;
 
   /* if started, set to stopped */
   res = g_atomic_int_compare_and_exchange (&buf->state,