mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-07-07 23:25:52 +00:00
check: Fix usage of dual probes
Using two (or more) probes on the same pad where one of the probe returns HANDLED or DROP is tricky since the other probes might not be called. Instead use regular probes and a proper pad (the sinkpad already existed, it only required to be activated and have a dummy chain function for the events/buffers to be received/handled properly)
This commit is contained in:
parent
4d2382fb27
commit
58a2df001c
|
@ -341,12 +341,10 @@ downstream_probe_cb (GstPad * pad, GstPadProbeInfo * info, TestData * test)
|
||||||
GST_EVENT_FLUSH_STOP)
|
GST_EVENT_FLUSH_STOP)
|
||||||
g_atomic_int_inc (&test->flush_stop_events);
|
g_atomic_int_inc (&test->flush_stop_events);
|
||||||
}
|
}
|
||||||
|
return GST_PAD_PROBE_OK;
|
||||||
gst_mini_object_unref (info->data);
|
|
||||||
|
|
||||||
return GST_PAD_PROBE_HANDLED;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Not thread safe, will create a new ChainData which contains
|
* Not thread safe, will create a new ChainData which contains
|
||||||
* an activated src pad linked to a requested sink pad of @agg, and
|
* an activated src pad linked to a requested sink pad of @agg, and
|
||||||
|
@ -382,6 +380,14 @@ _chain_data_clear (ChainData * data)
|
||||||
gst_object_unref (data->sinkpad);
|
gst_object_unref (data->sinkpad);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static GstFlowReturn
|
||||||
|
_test_chain (GstPad * pad, GstObject * object, GstBuffer * buffer)
|
||||||
|
{
|
||||||
|
/* accept any buffers */
|
||||||
|
gst_buffer_unref (buffer);
|
||||||
|
return GST_FLOW_OK;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_test_data_init (TestData * test, gboolean needs_flushing)
|
_test_data_init (TestData * test, gboolean needs_flushing)
|
||||||
{
|
{
|
||||||
|
@ -398,11 +404,11 @@ _test_data_init (TestData * test, gboolean needs_flushing)
|
||||||
|
|
||||||
num_sink_pads += 1;
|
num_sink_pads += 1;
|
||||||
test->sinkpad = gst_pad_new_from_static_template (&sinktemplate, pad_name);
|
test->sinkpad = gst_pad_new_from_static_template (&sinktemplate, pad_name);
|
||||||
|
gst_pad_set_chain_function (test->sinkpad, _test_chain);
|
||||||
|
gst_pad_set_active (test->sinkpad, TRUE);
|
||||||
g_free (pad_name);
|
g_free (pad_name);
|
||||||
fail_unless (gst_pad_link (test->srcpad, test->sinkpad) == GST_PAD_LINK_OK);
|
fail_unless (gst_pad_link (test->srcpad, test->sinkpad) == GST_PAD_LINK_OK);
|
||||||
gst_pad_add_probe (test->srcpad, GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM |
|
gst_pad_add_probe (test->srcpad, GST_PAD_PROBE_TYPE_EVENT_FLUSH,
|
||||||
GST_PAD_PROBE_TYPE_DATA_DOWNSTREAM |
|
|
||||||
GST_PAD_PROBE_TYPE_EVENT_FLUSH,
|
|
||||||
(GstPadProbeCallback) downstream_probe_cb, test, NULL);
|
(GstPadProbeCallback) downstream_probe_cb, test, NULL);
|
||||||
} else {
|
} else {
|
||||||
gst_pad_add_probe (test->srcpad, GST_PAD_PROBE_TYPE_BUFFER,
|
gst_pad_add_probe (test->srcpad, GST_PAD_PROBE_TYPE_BUFFER,
|
||||||
|
|
Loading…
Reference in a new issue