From 756f6eb3f2eae2e210a49ab1ef01e91ef0c5ba3d Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Wed, 9 Nov 2011 17:25:30 +0100 Subject: [PATCH] pad: refuse events in flushing when we are flushing, don't store the event on the pad but simply return FALSE. Don't deactivate the srcpad, we need it to be active in order to push the caps. Downstream can change the scheduling mode of an active pad. --- gst/gstpad.c | 6 +++--- plugins/elements/gsttypefindelement.c | 10 ++++++++++ 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/gst/gstpad.c b/gst/gstpad.c index f7c5ef7..df4865a 100644 --- a/gst/gstpad.c +++ b/gst/gstpad.c @@ -4302,6 +4302,9 @@ gst_pad_push_event (GstPad * pad, GstEvent * event) break; default: { + if (G_UNLIKELY (GST_PAD_IS_FLUSHING (pad))) + goto flushed; + /* store the event on the pad, but only on srcpads */ if (GST_PAD_IS_SRC (pad) && GST_EVENT_IS_STICKY (event)) { guint idx; @@ -4357,9 +4360,6 @@ gst_pad_push_event (GstPad * pad, GstEvent * event) break; } - if (G_UNLIKELY (GST_PAD_IS_FLUSHING (pad))) - goto flushed; - PROBE_PUSH (pad, type | GST_PAD_PROBE_TYPE_PUSH | GST_PAD_PROBE_TYPE_BLOCK, event, probe_stopped); diff --git a/plugins/elements/gsttypefindelement.c b/plugins/elements/gsttypefindelement.c index 9ed0bdf..e60af36 100644 --- a/plugins/elements/gsttypefindelement.c +++ b/plugins/elements/gsttypefindelement.c @@ -965,6 +965,8 @@ gst_type_find_element_activate (GstPad * pad) (guint64) size, ext, &probability); g_free (ext); + GST_DEBUG ("Found caps %" GST_PTR_FORMAT, found_caps); + gst_object_unref (peer); } } @@ -983,13 +985,18 @@ gst_type_find_element_activate (GstPad * pad) } /* 3 */ + GST_DEBUG ("Deactivate pull mode"); gst_pad_activate_pull (pad, FALSE); +#if 0 /* 4 */ + GST_DEBUG ("Deactivate push mode mode"); gst_pad_activate_push (typefind->src, FALSE); +#endif /* 5 */ if (!found_caps || probability < typefind->min_probability) { + GST_DEBUG ("Trying to guess using extension"); found_caps = gst_type_find_guess_by_extension (typefind, pad, &probability); } @@ -1002,9 +1009,11 @@ gst_type_find_element_activate (GstPad * pad) done: /* 7 */ + GST_DEBUG ("Emiting found caps %" GST_PTR_FORMAT, found_caps); g_signal_emit (typefind, gst_type_find_element_signals[HAVE_TYPE], 0, probability, found_caps); typefind->mode = MODE_NORMAL; + really_done: gst_caps_unref (found_caps); @@ -1014,6 +1023,7 @@ really_done: else { gboolean ret; + GST_DEBUG ("Activating in push mode"); ret = gst_pad_activate_push (typefind->src, TRUE); ret &= gst_pad_activate_push (pad, TRUE); return ret; -- 2.7.4