summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorSebastian Rasmussen <sebras@hotmail.com>2014-03-15 17:35:56 +0100
committerSebastian Dröge <sebastian@centricular.com>2015-10-02 17:44:14 +0300
commit042e71a117649a3559d16e790020c4e89e8a6bf9 (patch)
treec73d0a594d145749f4d1864f04054978a83ea784 /tests
parent476dff826e39a9c29d224294866420902090325d (diff)
rtpbasepayload: Implement video SDP attributes
Fixes https://bugzilla.gnome.org/show_bug.cgi?id=726472
Diffstat (limited to 'tests')
-rw-r--r--tests/check/libs/rtpbasepayload.c95
1 files changed, 95 insertions, 0 deletions
diff --git a/tests/check/libs/rtpbasepayload.c b/tests/check/libs/rtpbasepayload.c
index 900b0b96b..cb38be38b 100644
--- a/tests/check/libs/rtpbasepayload.c
+++ b/tests/check/libs/rtpbasepayload.c
@@ -287,6 +287,14 @@ validate_event (guint index, const gchar * name, const gchar * field, ...)
fail_unless (gst_structure_get_uint (gst_caps_get_structure (caps, 0),
"ssrc", &ssrc));
fail_unless_equals_int (ssrc, expected);
+ } else if (!g_strcmp0 (field, "a-framerate")) {
+ const gchar *expected = va_arg (var_args, const gchar *);
+ GstCaps *caps;
+ const gchar *framerate;
+ gst_event_parse_caps (event, &caps);
+ framerate = gst_structure_get_string (gst_caps_get_structure (caps, 0),
+ "a-framerate");
+ fail_unless_equals_string (framerate, expected);
} else {
fail ("test cannot validate unknown event field '%s'", field);
}
@@ -1764,6 +1772,90 @@ GST_START_TEST (rtp_base_payload_property_stats_test)
GST_END_TEST;
+/* push a single buffer to the payloader which should successfully payload it
+ * into an RTP packet. besides the payloaded RTP packet there should be the
+ * three events initial events: stream-start, caps and segment. because of that
+ * the input caps has framerate this will be propagated to an a-framerate field
+ * on the output caps.
+ */
+GST_START_TEST (rtp_base_payload_framerate_attribute)
+{
+ State *state;
+
+ state = create_payloader ("video/x-raw,framerate=(fraction)1/4", &sinktmpl,
+ "perfect-rtptime", FALSE,
+ NULL);
+
+ set_state (state, GST_STATE_PLAYING);
+
+ push_buffer (state,
+ "pts", 0 * GST_SECOND,
+ NULL);
+
+ set_state (state, GST_STATE_NULL);
+
+ validate_buffers_received (1);
+
+ validate_buffer (0,
+ "pts", 0 * GST_SECOND,
+ NULL);
+
+ validate_events_received (3);
+
+ validate_normal_start_events (0);
+
+ validate_event (1, "caps",
+ "a-framerate", "0.25",
+ NULL);
+
+ destroy_payloader (state);
+}
+
+GST_END_TEST;
+
+/* push a single buffer to the payloader which should successfully payload it
+ * into an RTP packet. besides the payloaded RTP packet there should be the
+ * three events initial events: stream-start, caps and segment. because of that
+ * the input caps has both framerate and max-framerate set the a-framerate field
+ * on the output caps will correspond to the value of the max-framerate field.
+ */
+GST_START_TEST (rtp_base_payload_max_framerate_attribute)
+{
+ State *state;
+
+ state = create_payloader (
+ "video/x-raw,framerate=(fraction)0/1,max-framerate=(fraction)1/8",
+ &sinktmpl,
+ "perfect-rtptime", FALSE,
+ NULL);
+
+ set_state (state, GST_STATE_PLAYING);
+
+ push_buffer (state,
+ "pts", 0 * GST_SECOND,
+ NULL);
+
+ set_state (state, GST_STATE_NULL);
+
+ validate_buffers_received (1);
+
+ validate_buffer (0,
+ "pts", 0 * GST_SECOND,
+ NULL);
+
+ validate_events_received (3);
+
+ validate_normal_start_events (0);
+
+ validate_event (1, "caps",
+ "a-framerate", "0.125",
+ NULL);
+
+ destroy_payloader (state);
+}
+
+GST_END_TEST;
+
static Suite *
rtp_basepayloading_suite (void)
{
@@ -1798,6 +1890,9 @@ rtp_basepayloading_suite (void)
tcase_add_test (tc_chain, rtp_base_payload_property_ptime_multiple_test);
tcase_add_test (tc_chain, rtp_base_payload_property_stats_test);
+ tcase_add_test (tc_chain, rtp_base_payload_framerate_attribute);
+ tcase_add_test (tc_chain, rtp_base_payload_max_framerate_attribute);
+
return s;
}