diff options
-rw-r--r-- | gst-libs/gst/audio/gstbaseaudiosink.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/gst-libs/gst/audio/gstbaseaudiosink.c b/gst-libs/gst/audio/gstbaseaudiosink.c index fee7c95e3..4ac43b7c6 100644 --- a/gst-libs/gst/audio/gstbaseaudiosink.c +++ b/gst-libs/gst/audio/gstbaseaudiosink.c @@ -61,6 +61,8 @@ struct _GstBaseAudioSinkPrivate /* number of microseconds we alow timestamps or clock slaving to drift * before resyncing */ guint64 drift_tolerance; + + gboolean may_provide_clock; }; /* BaseAudioSink signals and args */ @@ -338,6 +340,9 @@ gst_base_audio_sink_provide_clock (GstElement * elem) goto wrong_state; GST_OBJECT_LOCK (sink); + if (!sink->priv->may_provide_clock) + goto already_playing; + if (!sink->provide_clock) goto clock_disabled; @@ -352,6 +357,12 @@ wrong_state: GST_DEBUG_OBJECT (sink, "ringbuffer not acquired"); return NULL; } +already_playing: + { + GST_DEBUG_OBJECT (sink, "we went to playing already"); + GST_OBJECT_UNLOCK (sink); + return NULL; + } clock_disabled: { GST_DEBUG_OBJECT (sink, "clock provide disabled"); @@ -1825,6 +1836,7 @@ gst_base_audio_sink_change_state (GstElement * element, sink->next_sample = -1; sink->priv->last_align = -1; sink->priv->eos_time = -1; + sink->priv->may_provide_clock = TRUE; gst_ring_buffer_set_flushing (sink->ringbuffer, FALSE); gst_ring_buffer_may_start (sink->ringbuffer, FALSE); break; @@ -1832,6 +1844,7 @@ gst_base_audio_sink_change_state (GstElement * element, GST_OBJECT_LOCK (sink); GST_DEBUG_OBJECT (sink, "ringbuffer may start now"); sink->priv->sync_latency = TRUE; + sink->priv->may_provide_clock = FALSE; GST_OBJECT_UNLOCK (sink); gst_ring_buffer_may_start (sink->ringbuffer, TRUE); |