Commit 53e879c7 authored by Edward Hervey's avatar Edward Hervey 🤘 Committed by Tim-Philipp Müller

gstpad: Probes that return HANDLED can reset the data info field

Before GST_PAD_PROBE_HANDLED was introduced, we had to handle the case
where some probes would reset the probe info data field to NULL. This would
be considered an invalid use-case.

But with GST_PAD_PROBE_HANDLED it is totally fine to reset that, since
the probe has "handled" it.
parent 3a8910f5
Pipeline #54721 failed with stages
in 65 minutes and 22 seconds
......@@ -3569,7 +3569,8 @@ probe_hook_marshal (GHook * hook, ProbeMarshall * data)
if ((flags & GST_PAD_PROBE_TYPE_IDLE))
if (original_data != NULL && info->data == NULL) {
if (ret != GST_PAD_PROBE_HANDLED && original_data != NULL
&& info->data == NULL) {
GST_DEBUG_OBJECT (pad, "data item in pad probe info was dropped");
data->dropped = TRUE;
......@@ -622,6 +622,21 @@ _handled_probe_handler (GstPad * pad, GstPadProbeInfo * info, gpointer userdata)
static GstPadProbeReturn
_cleaning_handled_probe_handler (GstPad * pad, GstPadProbeInfo * info,
gpointer userdata)
GstFlowReturn customflow = (GstFlowReturn) GPOINTER_TO_INT (userdata);
/* We are handling the data, we unref it and we reset the data field */
gst_mini_object_unref (info->data);
GST_PAD_PROBE_INFO_FLOW_RETURN (info) = customflow;
GST_START_TEST (test_events_query_unlinked)
......@@ -786,6 +801,22 @@ GST_START_TEST (test_push_unlinked)
/* Same thing, except that this time we also set the info data field
* to NULL in the probe. We can because we are returning _HANDLED */
GST_DEBUG ("push buffer handled and custom return (with info data NULL'ed)");
for (fl = GST_FLOW_NOT_SUPPORTED; fl <= GST_FLOW_OK; fl += 1) {
GST_DEBUG ("Testing with %s", gst_flow_get_name (fl));
id = gst_pad_add_probe (src, GST_PAD_PROBE_TYPE_BUFFER,
_cleaning_handled_probe_handler, GINT_TO_POINTER (fl), NULL);
buffer = gst_buffer_new ();
gst_buffer_ref (buffer);
fail_unless (gst_pad_push (src, buffer) == fl);
ASSERT_MINI_OBJECT_REFCOUNT (buffer, "buffer", 1);
gst_buffer_unref (buffer);
gst_pad_remove_probe (src, id);
/* cleanup */
ASSERT_CAPS_REFCOUNT (caps, "caps", 2);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment