diff --git a/libs/gst/base/gstbasesink.c b/libs/gst/base/gstbasesink.c index 0cdbfc5439..9c85cd5a53 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 */ - 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; + 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; - /* 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