typefindelement: if sink pad is activated do not change mode
authorAlban Browaeys <prahal@yahoo.com>
Mon, 14 May 2012 01:57:50 +0000 (03:57 +0200)
committerWim Taymans <wim.taymans@collabora.co.uk>
Mon, 14 May 2012 10:56:05 +0000 (12:56 +0200)
In commit bf0964b6 a check for pad is activated was not carried.
This leads to attempt to pull while in push mode when force_caps
is set. In this case without the attached check even when activated
in pull mode we activate back to push mode.

This is from comment in previous code , case number eight:
 8. if the sink pad is activated, we are in pull mode. succeed.
-     otherwise activate both pads in push mode and succeed.

Putting it back fixes playback of webm in webkit+gstreamer 1.0 .

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=676003

plugins/elements/gsttypefindelement.c

index 436a4e9..e6c4de2 100644 (file)
@@ -1190,6 +1190,12 @@ gst_type_find_element_activate_sink (GstPad * pad, GstObject * parent)
     g_signal_emit (typefind, gst_type_find_element_signals[HAVE_TYPE],
         0, probability, found_caps);
     typefind->mode = MODE_NORMAL;
+    /* the signal above could have made a downstream element activate
+     * the pad in pull mode, we check if the pad is already active now and if
+     * so, we are done */
+    if (gst_pad_is_active (pad))
+      return TRUE;
+
     goto typefind_push;
   }
   GST_OBJECT_UNLOCK (typefind);