mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-02 21:48:55 +00:00
tests: Change tests to not use the priority pads instead of the events
This commit is contained in:
parent
70097866de
commit
5bd023fb96
1 changed files with 24 additions and 21 deletions
|
@ -69,7 +69,8 @@ event_func (GstPad * pad, GstEvent * event)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
test_basic (const gchar * elem_name, int count, check_cb cb)
|
test_basic (const gchar * elem_name, const gchar * sink2, int count,
|
||||||
|
check_cb cb)
|
||||||
{
|
{
|
||||||
GstElement *rtpmux = NULL;
|
GstElement *rtpmux = NULL;
|
||||||
GstPad *reqpad1 = NULL;
|
GstPad *reqpad1 = NULL;
|
||||||
|
@ -89,7 +90,7 @@ test_basic (const gchar * elem_name, int count, check_cb cb)
|
||||||
|
|
||||||
reqpad1 = gst_element_get_request_pad (rtpmux, "sink_1");
|
reqpad1 = gst_element_get_request_pad (rtpmux, "sink_1");
|
||||||
fail_unless (reqpad1 != NULL);
|
fail_unless (reqpad1 != NULL);
|
||||||
reqpad2 = gst_element_get_request_pad (rtpmux, "sink_2");
|
reqpad2 = gst_element_get_request_pad (rtpmux, sink2);
|
||||||
fail_unless (reqpad2 != NULL);
|
fail_unless (reqpad2 != NULL);
|
||||||
sink = gst_check_setup_sink_pad_by_name (rtpmux, &sinktemplate, "src");
|
sink = gst_check_setup_sink_pad_by_name (rtpmux, &sinktemplate, "src");
|
||||||
|
|
||||||
|
@ -140,11 +141,10 @@ test_basic (const gchar * elem_name, int count, check_cb cb)
|
||||||
"ssrc", G_TYPE_UINT, 66, NULL);
|
"ssrc", G_TYPE_UINT, 66, NULL);
|
||||||
fail_unless (gst_pad_set_caps (src1, caps));
|
fail_unless (gst_pad_set_caps (src1, caps));
|
||||||
|
|
||||||
newsegment = gst_event_new_new_segment (FALSE, 1, GST_FORMAT_TIME,
|
newsegment = gst_event_new_new_segment (FALSE, 1, GST_FORMAT_TIME, 100000,
|
||||||
100000, -1, 0);
|
-1, 0);
|
||||||
fail_unless (gst_pad_push_event (src1, newsegment));
|
fail_unless (gst_pad_push_event (src1, newsegment));
|
||||||
newsegment = gst_event_new_new_segment (FALSE, 1, GST_FORMAT_TIME,
|
newsegment = gst_event_new_new_segment (FALSE, 1, GST_FORMAT_TIME, 0, -1, 0);
|
||||||
50000, -1, 0);
|
|
||||||
fail_unless (gst_pad_push_event (src2, newsegment));
|
fail_unless (gst_pad_push_event (src2, newsegment));
|
||||||
|
|
||||||
for (i = 0; i < count; i++) {
|
for (i = 0; i < count; i++) {
|
||||||
|
@ -180,7 +180,7 @@ test_basic (const gchar * elem_name, int count, check_cb cb)
|
||||||
gst_object_unref (reqpad1);
|
gst_object_unref (reqpad1);
|
||||||
gst_object_unref (reqpad2);
|
gst_object_unref (reqpad2);
|
||||||
gst_check_teardown_pad_by_name (rtpmux, "sink_1");
|
gst_check_teardown_pad_by_name (rtpmux, "sink_1");
|
||||||
gst_check_teardown_pad_by_name (rtpmux, "sink_2");
|
gst_check_teardown_pad_by_name (rtpmux, sink2);
|
||||||
gst_element_release_request_pad (rtpmux, reqpad1);
|
gst_element_release_request_pad (rtpmux, reqpad1);
|
||||||
gst_element_release_request_pad (rtpmux, reqpad2);
|
gst_element_release_request_pad (rtpmux, reqpad2);
|
||||||
|
|
||||||
|
@ -205,14 +205,14 @@ basic_check_cb (GstPad * pad, int i)
|
||||||
|
|
||||||
GST_START_TEST (test_rtpmux_basic)
|
GST_START_TEST (test_rtpmux_basic)
|
||||||
{
|
{
|
||||||
test_basic ("rtpmux", 10, basic_check_cb);
|
test_basic ("rtpmux", "sink_2", 10, basic_check_cb);
|
||||||
}
|
}
|
||||||
|
|
||||||
GST_END_TEST;
|
GST_END_TEST;
|
||||||
|
|
||||||
GST_START_TEST (test_rtpdtmfmux_basic)
|
GST_START_TEST (test_rtpdtmfmux_basic)
|
||||||
{
|
{
|
||||||
test_basic ("rtpdtmfmux", 10, basic_check_cb);
|
test_basic ("rtpdtmfmux", "sink_2", 10, basic_check_cb);
|
||||||
}
|
}
|
||||||
|
|
||||||
GST_END_TEST;
|
GST_END_TEST;
|
||||||
|
@ -220,16 +220,7 @@ GST_END_TEST;
|
||||||
static void
|
static void
|
||||||
lock_check_cb (GstPad * pad, int i)
|
lock_check_cb (GstPad * pad, int i)
|
||||||
{
|
{
|
||||||
GstStructure *s;
|
GstBuffer *inbuf;
|
||||||
GstEvent *event;
|
|
||||||
|
|
||||||
if (i % 2)
|
|
||||||
s = gst_structure_new ("stream-lock", "lock", G_TYPE_BOOLEAN, FALSE, NULL);
|
|
||||||
else
|
|
||||||
s = gst_structure_new ("stream-lock", "lock", G_TYPE_BOOLEAN, TRUE, NULL);
|
|
||||||
|
|
||||||
event = gst_event_new_custom (GST_EVENT_CUSTOM_DOWNSTREAM_OOB, s);
|
|
||||||
gst_pad_push_event (pad, event);
|
|
||||||
|
|
||||||
if (i % 2) {
|
if (i % 2) {
|
||||||
fail_unless (buffers == NULL);
|
fail_unless (buffers == NULL);
|
||||||
|
@ -238,7 +229,19 @@ lock_check_cb (GstPad * pad, int i)
|
||||||
fail_unless (gst_rtp_buffer_get_ssrc (buffers->data) == 55);
|
fail_unless (gst_rtp_buffer_get_ssrc (buffers->data) == 55);
|
||||||
fail_unless (gst_rtp_buffer_get_timestamp (buffers->data) ==
|
fail_unless (gst_rtp_buffer_get_timestamp (buffers->data) ==
|
||||||
200 - 57 + 1000 + i);
|
200 - 57 + 1000 + i);
|
||||||
fail_unless (gst_rtp_buffer_get_seq (buffers->data) == 100 + 1 + (i / 2));
|
fail_unless (gst_rtp_buffer_get_seq (buffers->data) == 100 + 1 + i);
|
||||||
|
|
||||||
|
inbuf = gst_rtp_buffer_new_allocate (10, 0, 0);
|
||||||
|
GST_BUFFER_TIMESTAMP (inbuf) = i * 1000 + 500;
|
||||||
|
GST_BUFFER_DURATION (inbuf) = 1000;
|
||||||
|
gst_rtp_buffer_set_version (inbuf, 2);
|
||||||
|
gst_rtp_buffer_set_payload_type (inbuf, 98);
|
||||||
|
gst_rtp_buffer_set_ssrc (inbuf, 44);
|
||||||
|
gst_rtp_buffer_set_timestamp (inbuf, 200 + i);
|
||||||
|
gst_rtp_buffer_set_seq (inbuf, 2000 + i);
|
||||||
|
fail_unless (gst_pad_push (pad, inbuf) == GST_FLOW_OK);
|
||||||
|
|
||||||
|
|
||||||
g_list_foreach (buffers, (GFunc) gst_buffer_unref, NULL);
|
g_list_foreach (buffers, (GFunc) gst_buffer_unref, NULL);
|
||||||
g_list_free (buffers);
|
g_list_free (buffers);
|
||||||
buffers = NULL;
|
buffers = NULL;
|
||||||
|
@ -247,7 +250,7 @@ lock_check_cb (GstPad * pad, int i)
|
||||||
|
|
||||||
GST_START_TEST (test_rtpdtmfmux_lock)
|
GST_START_TEST (test_rtpdtmfmux_lock)
|
||||||
{
|
{
|
||||||
test_basic ("rtpdtmfmux", 10, lock_check_cb);
|
test_basic ("rtpdtmfmux", "priority_sink_2", 10, lock_check_cb);
|
||||||
}
|
}
|
||||||
|
|
||||||
GST_END_TEST;
|
GST_END_TEST;
|
||||||
|
|
Loading…
Reference in a new issue