[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gstreamer-cvs
Subject:    [0.11] gst-plugins-base: baseaudiosink: arrange for running clock
From:       wtay () kemper ! freedesktop ! org (Wim Taymans)
Date:       2011-03-31 16:41:15
Message-ID: 20110331164115.658D5F80AB () kemper ! freedesktop ! org
[Download RAW message or body]

Module: gst-plugins-base
Branch: 0.11
Commit: e73f293ee560379d3667c832be8165042a186877
URL:    http://cgit.freedesktop.org/gstreamer/gst-plugins-base/commit/?id=e73f293ee560379d3667c832be8165042a186877


Author: Mark Nauwelaerts <mark.nauwelaerts@collabora.co.uk>
Date:   Mon Mar 28 22:00:25 2011 +0200

baseaudiosink: arrange for running clock when rendering eos

Commit ba2e500bd992d8ad7db0da923801964964835967 ensured to provide
a running clock when EOS had finished rendering.  However,
other measures are needed (and were in place before) to ensure a
running clock when EOS still needs rendering (i.e. waiting).

So, specifically, re-introduce eos_rendering removed in aforementioned commit,
this time as a public variable so subclasses can be aware of the situation.

Fixes (part of) #645961.

API: GstBaseAudioSink:eos_rendering

---

 gst-libs/gst/audio/gstbaseaudiosink.c |    8 +++++++-
 gst-libs/gst/audio/gstbaseaudiosink.h |    9 ++++++++-
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/gst-libs/gst/audio/gstbaseaudiosink.c \
b/gst-libs/gst/audio/gstbaseaudiosink.c index f8b18b0..c0f6008 100644
--- a/gst-libs/gst/audio/gstbaseaudiosink.c
+++ b/gst-libs/gst/audio/gstbaseaudiosink.c
@@ -836,6 +836,10 @@ gst_base_audio_sink_drain (GstBaseAudioSink * sink)
   if (!sink->ringbuffer->spec.rate)
     return TRUE;
 
+  /* if PLAYING is interrupted,
+   * arrange to have clock running when going to PLAYING again */
+  g_atomic_int_set (&sink->abidata.ABI.eos_rendering, 1);
+
   /* need to start playback before we can drain, but only when
    * we have successfully negotiated a format and thus acquired the
    * ringbuffer. */
@@ -853,6 +857,7 @@ gst_base_audio_sink_drain (GstBaseAudioSink * sink)
 
     GST_DEBUG_OBJECT (sink, "drained audio");
   }
+  g_atomic_int_set (&sink->abidata.ABI.eos_rendering, 0);
   return TRUE;
 }
 
@@ -1906,7 +1911,8 @@ gst_base_audio_sink_change_state (GstElement * element,
       GST_OBJECT_UNLOCK (sink);
 
       gst_ring_buffer_may_start (sink->ringbuffer, TRUE);
-      if (GST_BASE_SINK_CAST (sink)->pad_mode == GST_ACTIVATE_PULL || eos) {
+      if (GST_BASE_SINK_CAST (sink)->pad_mode == GST_ACTIVATE_PULL ||
+          g_atomic_int_get (&sink->abidata.ABI.eos_rendering) || eos) {
         /* we always start the ringbuffer in pull mode immediatly */
         /* sync rendering on eos needs running clock,
          * and others need running clock when finished rendering eos */
diff --git a/gst-libs/gst/audio/gstbaseaudiosink.h \
b/gst-libs/gst/audio/gstbaseaudiosink.h index c4d7a01..12a90f9 100644
--- a/gst-libs/gst/audio/gstbaseaudiosink.h
+++ b/gst-libs/gst/audio/gstbaseaudiosink.h
@@ -127,7 +127,14 @@ struct _GstBaseAudioSink {
   /*< private >*/
   GstBaseAudioSinkPrivate *priv;
 
-  gpointer _gst_reserved[GST_PADDING - 1];
+  union {
+    struct {
+      /*< protected >*/
+      /* with g_atomic_; currently rendering eos */
+      gboolean   eos_rendering;
+    } ABI;
+    gpointer _gst_reserved[GST_PADDING - 1];
+  } abidata;
 };
 
 /**

_______________________________________________
gstreamer-commits mailing list
gstreamer-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/gstreamer-commits


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic