pad: Don't call remaining probes after they return DROPPED|HANDLED
authorEdward Hervey <edward@centricular.com>
Mon, 4 Sep 2017 12:33:29 +0000 (14:33 +0200)
committerEdward Hervey <bilboed@bilboed.com>
Mon, 4 Sep 2017 12:37:42 +0000 (14:37 +0200)
If multiple probes are set on a pad and one probe returns either
GST_PAD_PROBE_HANDLED or GST_PAD_PROBE_DROPPED we need to stop
calling the remaining probes.

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

gst/gstpad.c

index 67e8535..a5475ab 100644 (file)
@@ -3425,6 +3425,16 @@ probe_hook_marshal (GHook * hook, ProbeMarshall * data)
   if ((flags & GST_PAD_PROBE_TYPE_SCHEDULING & type) == 0)
     goto no_match;
 
+  if (G_UNLIKELY (data->handled)) {
+    GST_CAT_LOG_OBJECT (GST_CAT_SCHEDULING, pad,
+        "probe previously returned HANDLED, not calling again");
+    goto no_match;
+  } else if (G_UNLIKELY (data->dropped)) {
+    GST_CAT_LOG_OBJECT (GST_CAT_SCHEDULING, pad,
+        "probe previously returned DROPPED, not calling again");
+    goto no_match;
+  }
+
   if (type & GST_PAD_PROBE_TYPE_PUSH) {
     /* one of the data types for non-idle probes */
     if ((type & GST_PAD_PROBE_TYPE_IDLE) == 0