pad: Store sticky events even if the pad is flushing

But do this only for events that are not dropped by flushing,
i.e. do it only for everything except SEGMENT and EOS.

Without this we might drop a CAPS event if flushing happens
at an unfortunate time and nobody is resending the CAPS event.

https://bugzilla.gnome.org/show_bug.cgi?id=700806
This commit is contained in:
Sebastian Dröge 2013-05-27 12:40:50 +02:00
parent 5bbc6f1c8c
commit 73895c05b1

View file

@ -4451,13 +4451,20 @@ store_sticky_event (GstPad * pad, GstEvent * event)
const gchar *name = NULL;
gboolean insert = TRUE;
if (G_UNLIKELY (GST_PAD_IS_FLUSHING (pad)))
type = GST_EVENT_TYPE (event);
/* Store all sticky events except SEGMENT/SEGMENT when we're flushing,
* otherwise they can be dropped and nothing would ever resend them.
* Only do that for activated pads though, everything else is a bug!
*/
if (G_UNLIKELY (GST_PAD_MODE (pad) == GST_PAD_MODE_NONE
|| (GST_PAD_IS_FLUSHING (pad) && (type == GST_EVENT_SEGMENT
|| type == GST_EVENT_EOS))))
goto flushed;
if (G_UNLIKELY (GST_PAD_IS_EOS (pad)))
goto eos;
type = GST_EVENT_TYPE (event);
if (type & GST_EVENT_TYPE_STICKY_MULTI)
name = gst_structure_get_name (gst_event_get_structure (event));
@ -4527,7 +4534,7 @@ store_sticky_event (GstPad * pad, GstEvent * event)
if (type == GST_EVENT_EOS)
GST_OBJECT_FLAG_SET (pad, GST_PAD_FLAG_EOS);
return GST_FLOW_OK;
return GST_PAD_IS_FLUSHING (pad) ? GST_FLOW_FLUSHING : GST_FLOW_OK;
/* ERRORS */
flushed: