From: Edward Hervey Date: Mon, 6 Jun 2011 09:20:29 +0000 (+0200) Subject: basesink: Don't accept segments after EOS X-Git-Tag: RELEASE-0.11.0~159 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=69800aa307abe2d3ea7cca403f8feca26ba477e3;p=platform%2Fupstream%2Fgstreamer.git basesink: Don't accept segments after EOS And refactor the code slightly to avoid code duplication. This solves a regression introduced by bdbc0693 --- diff --git a/libs/gst/base/gstbasesink.c b/libs/gst/base/gstbasesink.c index 0cdbfc5..9c85cd5 100644 --- a/libs/gst/base/gstbasesink.c +++ b/libs/gst/base/gstbasesink.c @@ -3316,22 +3316,20 @@ gst_base_sink_event (GstPad * pad, GstEvent * event) if (G_UNLIKELY (basesink->flushing)) goto flushing; - if (G_UNLIKELY (basesink->priv->received_eos)) { - /* we can't accept anything when we are EOS */ + if (G_UNLIKELY (basesink->priv->received_eos)) + goto after_eos; + + /* we set the received EOS flag here so that we can use it when testing if + * we are prerolled and to refuse more buffers. */ + basesink->priv->received_eos = TRUE; + + /* EOS is a prerollable object, we call the unlocked version because it + * does not check the received_eos flag. */ + ret = gst_base_sink_queue_object_unlocked (basesink, pad, + _PR_IS_EVENT, GST_MINI_OBJECT_CAST (event), TRUE); + if (G_UNLIKELY (ret != GST_FLOW_OK)) result = FALSE; - gst_event_unref (event); - } else { - /* we set the received EOS flag here so that we can use it when testing if - * we are prerolled and to refuse more buffers. */ - basesink->priv->received_eos = TRUE; - - /* EOS is a prerollable object, we call the unlocked version because it - * does not check the received_eos flag. */ - ret = gst_base_sink_queue_object_unlocked (basesink, pad, - _PR_IS_EVENT, GST_MINI_OBJECT_CAST (event), TRUE); - if (G_UNLIKELY (ret != GST_FLOW_OK)) - result = FALSE; - } + GST_BASE_SINK_PREROLL_UNLOCK (basesink); break; } @@ -3358,6 +3356,9 @@ gst_base_sink_event (GstPad * pad, GstEvent * event) if (G_UNLIKELY (basesink->flushing)) goto flushing; + if (G_UNLIKELY (basesink->priv->received_eos)) + goto after_eos; + /* the new segment is a non prerollable item and does not block anything, * we need to configure the current clipping segment and insert the event * in the queue to serialize it with the buffers for rendering. */ @@ -3424,6 +3425,15 @@ flushing: gst_event_unref (event); goto done; } + +after_eos: + { + GST_DEBUG_OBJECT (basesink, "Event received after EOS, dropping"); + GST_BASE_SINK_PREROLL_UNLOCK (basesink); + result = FALSE; + gst_event_unref (event); + goto done; + } } /* default implementation to calculate the start and end