summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThiago Santos <thiago.sousa.santos@collabora.co.uk>2010-01-28 11:57:33 -0300
committerThiago Santos <thiago.sousa.santos@collabora.co.uk>2010-02-12 17:23:29 -0300
commit51d382e2eef0ed6aea6319403a33dfd7abcd235e (patch)
treecf9aeb54f7880d00a22e11d4a5c424dd2e75dd72
parentfae502056f8a6c84a8428142a4a319b346eb922c (diff)
typefind: Avoid messing pads activation
Typefind might mess up pads modes (pull/push) if a downstream element is plugged and its pads activated in 'step 2' of typefind pads activation. This happens because the following steps don't check if we already emitted typefound due to upstream setting caps on buffers being pulled in the typefind helpers. Avoid that by checking if typefound is already emmited. Fixes #608036
-rw-r--r--plugins/elements/gsttypefindelement.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/plugins/elements/gsttypefindelement.c b/plugins/elements/gsttypefindelement.c
index 2073006f64..8c401e5372 100644
--- a/plugins/elements/gsttypefindelement.c
+++ b/plugins/elements/gsttypefindelement.c
@@ -951,6 +951,18 @@ gst_type_find_element_activate (GstPad * pad)
}
}
+ /* the type find helpers might have triggered setcaps here (due to upstream)
+ * setting caps on buffers, which emits typefound signal and an element
+ * could have been linked and have its pads activated
+ *
+ * If we deactivate the pads in the following steps we might mess up
+ * downstream element. We should prevent that.
+ */
+ if (typefind->mode == MODE_NORMAL) {
+ /* this means we already emitted typefound */
+ goto really_done;
+ }
+
/* 3 */
gst_pad_activate_pull (pad, FALSE);
@@ -973,8 +985,9 @@ done:
/* 7 */
g_signal_emit (typefind, gst_type_find_element_signals[HAVE_TYPE],
0, probability, found_caps);
- gst_caps_unref (found_caps);
typefind->mode = MODE_NORMAL;
+really_done:
+ gst_caps_unref (found_caps);
/* 8 */
if (gst_pad_is_active (pad))