From 7d11a78f06d76fb7d453cc62399514fbebc08f47 Mon Sep 17 00:00:00 2001 From: eunhae choi Date: Mon, 14 Sep 2015 15:25:11 +0900 Subject: audiobasesink: fix issue about eos handling during flushing If the flush-start is arrived during _eos_wait() in basesink, the 'eos' flag is overwritten to TRUE after exiting the _eos_wait(). To resolve the overwritten issue, the subclass doing the _eos_wait() call should return the right value. If the eos flag is set to TRUE again, it will cause error(enter the eos flow) of the following state changing from PAUSED to PLAYING in basesink. https://bugzilla.gnome.org/show_bug.cgi?id=754980 --- gst-libs/gst/audio/gstaudiobasesink.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/gst-libs/gst/audio/gstaudiobasesink.c b/gst-libs/gst/audio/gstaudiobasesink.c index 704801e45..45050224f 100644 --- a/gst-libs/gst/audio/gstaudiobasesink.c +++ b/gst-libs/gst/audio/gstaudiobasesink.c @@ -1086,13 +1086,14 @@ gst_audio_base_sink_force_start (GstAudioBaseSink * sink) } /* This waits for the drain to happen and can be canceled */ -static gboolean +static GstFlowReturn gst_audio_base_sink_drain (GstAudioBaseSink * sink) { + GstFlowReturn ret = GST_FLOW_OK; if (!sink->ringbuffer) - return TRUE; + return ret; if (!sink->ringbuffer->spec.info.rate) - return TRUE; + return ret; /* if PLAYING is interrupted, * arrange to have clock running when going to PLAYING again */ @@ -1111,19 +1112,19 @@ gst_audio_base_sink_drain (GstAudioBaseSink * sink) /* wait for the EOS time to be reached, this is the time when the last * sample is played. */ - gst_base_sink_wait (GST_BASE_SINK (sink), sink->priv->eos_time, NULL); + ret = gst_base_sink_wait (GST_BASE_SINK (sink), sink->priv->eos_time, NULL); GST_DEBUG_OBJECT (sink, "drained audio"); } g_atomic_int_set (&sink->eos_rendering, 0); - return TRUE; + return ret; } static GstFlowReturn gst_audio_base_sink_wait_event (GstBaseSink * bsink, GstEvent * event) { GstAudioBaseSink *sink = GST_AUDIO_BASE_SINK (bsink); - GstFlowReturn ret; + GstFlowReturn ret = GST_FLOW_OK; gboolean clear_force_start_flag = FALSE; /* For both gap and EOS events, make sure the ringbuffer is running @@ -1155,7 +1156,7 @@ gst_audio_base_sink_wait_event (GstBaseSink * bsink, GstEvent * event) switch (GST_EVENT_TYPE (event)) { case GST_EVENT_EOS: /* now wait till we played everything */ - gst_audio_base_sink_drain (sink); + ret = gst_audio_base_sink_drain (sink); break; default: break; -- cgit v1.2.1