From 73895c05b116bf0fcfc7c2b12d3f1b04688c8525 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sebastian=20Dr=C3=B6ge?= Date: Mon, 27 May 2013 12:40:50 +0200 Subject: [PATCH] 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 --- gst/gstpad.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/gst/gstpad.c b/gst/gstpad.c index dc2d8e0..731fda2 100644 --- a/gst/gstpad.c +++ b/gst/gstpad.c @@ -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: -- 2.7.4