Commit ba2e500b authored by Mark Nauwelaerts's avatar Mark Nauwelaerts
Browse files

baseaudiosink: start ringbuffer upon going to PLAYING and already EOS

... otherwise we may end up without running clock in PLAYING.

Fixes #636886.
parent cf9aaffc
......@@ -56,7 +56,6 @@ struct _GstBaseAudioSinkPrivate
gboolean sync_latency;
GstClockTime eos_time;
gint eos_rendering;
gboolean do_time_offset;
/* number of microseconds we alow timestamps or clock slaving to drift
......@@ -837,10 +836,6 @@ 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->priv->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. */
......@@ -858,7 +853,6 @@ gst_base_audio_sink_drain (GstBaseAudioSink * sink)
GST_DEBUG_OBJECT (sink, "drained audio");
}
g_atomic_int_set (&sink->priv->eos_rendering, 0);
return TRUE;
}
......@@ -1888,7 +1882,6 @@ gst_base_audio_sink_change_state (GstElement * element,
sink->next_sample = -1;
sink->priv->last_align = -1;
sink->priv->eos_time = -1;
sink->priv->eos_rendering = 0;
gst_ring_buffer_set_flushing (sink->ringbuffer, FALSE);
gst_ring_buffer_may_start (sink->ringbuffer, FALSE);
......@@ -1903,19 +1896,24 @@ gst_base_audio_sink_change_state (GstElement * element,
sink->provided_clock, TRUE));
break;
case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
{
gboolean eos;
GST_OBJECT_LOCK (sink);
GST_DEBUG_OBJECT (sink, "ringbuffer may start now");
sink->priv->sync_latency = TRUE;
eos = GST_BASE_SINK (sink)->eos;
GST_OBJECT_UNLOCK (sink);
gst_ring_buffer_may_start (sink->ringbuffer, TRUE);
if (GST_BASE_SINK_CAST (sink)->pad_mode == GST_ACTIVATE_PULL ||
g_atomic_int_get (&sink->priv->eos_rendering)) {
if (GST_BASE_SINK_CAST (sink)->pad_mode == GST_ACTIVATE_PULL || eos) {
/* we always start the ringbuffer in pull mode immediatly */
/* sync rendering on eos needs running clock */
/* sync rendering on eos needs running clock,
* and others need running clock when finished rendering eos */
gst_ring_buffer_start (sink->ringbuffer);
}
break;
}
case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
/* ringbuffer cannot start anymore */
gst_ring_buffer_may_start (sink->ringbuffer, FALSE);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment