basesink: Don't accept segments after EOS

And refactor the code slightly to avoid code duplication.

This solves a regression introduced by bdbc0693
This commit is contained in:
Edward Hervey 2011-06-06 11:20:29 +02:00
parent ef2d593e40
commit 69800aa307

View file

@ -3316,22 +3316,20 @@ gst_base_sink_event (GstPad * pad, GstEvent * event)
if (G_UNLIKELY (basesink->flushing)) if (G_UNLIKELY (basesink->flushing))
goto flushing; goto flushing;
if (G_UNLIKELY (basesink->priv->received_eos)) { if (G_UNLIKELY (basesink->priv->received_eos))
/* we can't accept anything when we are EOS */ goto after_eos;
result = FALSE;
gst_event_unref (event); /* we set the received EOS flag here so that we can use it when testing if
} else { * we are prerolled and to refuse more buffers. */
/* we set the received EOS flag here so that we can use it when testing if basesink->priv->received_eos = TRUE;
* 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); GST_BASE_SINK_PREROLL_UNLOCK (basesink);
break; break;
} }
@ -3358,6 +3356,9 @@ gst_base_sink_event (GstPad * pad, GstEvent * event)
if (G_UNLIKELY (basesink->flushing)) if (G_UNLIKELY (basesink->flushing))
goto 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, /* 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 * we need to configure the current clipping segment and insert the event
* in the queue to serialize it with the buffers for rendering. */ * in the queue to serialize it with the buffers for rendering. */
@ -3424,6 +3425,15 @@ flushing:
gst_event_unref (event); gst_event_unref (event);
goto done; 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 /* default implementation to calculate the start and end