summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWim Taymans <wim.taymans@collabora.co.uk>2010-03-02 11:26:18 +0100
committerWim Taymans <wim.taymans@collabora.co.uk>2010-03-02 11:26:18 +0100
commit20dad9f3ad9bfada41cbe6bd2c585afad9011383 (patch)
tree2755df65fbda5d11ebacbe72f300a9bbeaf1f57b
parent6eef04c1cb6beeafb5b8d4b57b902c5a2ab39178 (diff)
audiosink: don't provide a clock after we went to PLAYINGaudiosink-clock
After we went to the PLAYING state, refuse to provide a clock untill we go back to READY.
-rw-r--r--gst-libs/gst/audio/gstbaseaudiosink.c13
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);