summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorOlivier CrĂȘte <olivier.crete@collabora.co.uk>2010-05-07 18:40:30 -0400
committerOlivier CrĂȘte <olivier.crete@collabora.co.uk>2010-06-02 20:47:08 -0400
commit55c3190dfb5963004cbba65a970eba617232ed19 (patch)
tree1360b6ac532f382cf65425060f3f530319d9f41b /tests
parent136d4688c06483b3fba434b5d24811966c9224ca (diff)
tests: Change tests to not use the priority pads instead of the events
Diffstat (limited to 'tests')
-rw-r--r--tests/check/elements/rtpmux.c45
1 files changed, 24 insertions, 21 deletions
diff --git a/tests/check/elements/rtpmux.c b/tests/check/elements/rtpmux.c
index 5c55634b2..133ee6daf 100644
--- a/tests/check/elements/rtpmux.c
+++ b/tests/check/elements/rtpmux.c
@@ -69,7 +69,8 @@ event_func (GstPad * pad, GstEvent * event)
}
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;
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");
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);
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);
fail_unless (gst_pad_set_caps (src1, caps));
- newsegment = gst_event_new_new_segment (FALSE, 1, GST_FORMAT_TIME,
- 100000, -1, 0);
+ newsegment = gst_event_new_new_segment (FALSE, 1, GST_FORMAT_TIME, 100000,
+ -1, 0);
fail_unless (gst_pad_push_event (src1, newsegment));
- newsegment = gst_event_new_new_segment (FALSE, 1, GST_FORMAT_TIME,
- 50000, -1, 0);
+ newsegment = gst_event_new_new_segment (FALSE, 1, GST_FORMAT_TIME, 0, -1, 0);
fail_unless (gst_pad_push_event (src2, newsegment));
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 (reqpad2);
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, reqpad2);
@@ -205,14 +205,14 @@ basic_check_cb (GstPad * pad, int i)
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_START_TEST (test_rtpdtmfmux_basic)
{
- test_basic ("rtpdtmfmux", 10, basic_check_cb);
+ test_basic ("rtpdtmfmux", "sink_2", 10, basic_check_cb);
}
GST_END_TEST;
@@ -220,16 +220,7 @@ GST_END_TEST;
static void
lock_check_cb (GstPad * pad, int i)
{
- GstStructure *s;
- 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);
+ GstBuffer *inbuf;
if (i % 2) {
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_timestamp (buffers->data) ==
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_free (buffers);
buffers = NULL;
@@ -247,7 +250,7 @@ lock_check_cb (GstPad * pad, int i)
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;