Add FEC SDP message test

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1527>
This commit is contained in:
Tomasz Andrzejak 2022-01-15 19:03:33 +01:00 committed by GStreamer Marge Bot
parent 95f5538fa4
commit 5fb769e95d
2 changed files with 66 additions and 1 deletions

View file

@ -3720,7 +3720,7 @@ gst_sdp_media_get_caps_from_media (const GstSDPMedia * media, gint pt)
}
}
if (strlen (key)) {
if (strlen (key) > 0) {
tmp = g_ascii_strdown (key, -1);
gst_structure_set (s, tmp, G_TYPE_STRING, val, NULL);
g_free (tmp);

View file

@ -155,6 +155,34 @@ static const gchar caps_video_extmap_pt_100[] =
"extmap-3=(string)<\"recvonly\",\"http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time\",\"\">, "
"extmap-4=(string)<\"\",\"urn:3gpp:video-orientation\",\"attributes\">";
static const gchar * sdp_fmtp = "v=0\r\n"
"o=ali 1122334455 1122334466 IN IP4 fec.example.com\r\n"
"s=Raptor RTP FEC Example\r\n"
"t=0 0\r\n"
"a=group:FEC-FR S1 R1\r\n"
"m=video 30000 RTP/AVP 100\r\n"
"c=IN IP4 233.252.0.1/127\r\n"
"a=rtpmap:100 MP2T/90000\r\n"
"a=fec-source-flow: id=0\r\n"
"a=mid:S1\r\n"
"m=application 30000 RTP/AVP 110\r\n"
"c=IN IP4 233.252.0.2/127\r\n"
"a=rtpmap:110 raptorfec/90000\r\n"
"a=fmtp:110 raptor-scheme-id=1; Kmax=8192; T=128; P=A; repair-window=200000\r\n"
"a=mid:R1\r\n";
static const gchar caps_video_raptor_fec_pt_100[] =
"application/x-unknown, media=(string)video, payload=(int)100, "
"clock-rate=(int)90000, encoding-name=(string)MP2T, "
"a-fec-source-flow=(string)\"\\ id\\=0\", a-mid=(string)S1";
static const gchar caps_application_raptor_fec_pt_110[] =
"application/x-unknown, media=(string)application, payload=(int)110, "
"clock-rate=(int)90000, encoding-name=(string)RAPTORFEC, "
"raptor-scheme-id=(string)1, kmax=(string)8192, t=(string)128, p=(string)A, repair-window=(string)200000, "
"a-mid=(string)R1";
/* *INDENT-ON* */
GST_START_TEST (boxed)
@ -591,6 +619,42 @@ GST_START_TEST (caps_from_media_extmap)
gst_sdp_message_free (message);
}
GST_END_TEST
GST_START_TEST (caps_from_media_fmtp)
{
GstSDPMessage *message;
glong length = -1;
const GstSDPMedia *media1, *media2;
GstCaps *caps1, *caps2;
GstCaps *result1, *result2;
gst_sdp_message_new (&message);
gst_sdp_message_parse_buffer ((guint8 *) sdp_fmtp, length, message);
media1 = gst_sdp_message_get_media (message, 0);
fail_unless (media1 != NULL);
caps1 = gst_sdp_media_get_caps_from_media (media1, 100);
gst_sdp_media_attributes_to_caps (media1, caps1);
result1 = gst_caps_from_string (caps_video_raptor_fec_pt_100);
fail_unless (gst_caps_is_strictly_equal (caps1, result1));
gst_caps_unref (result1);
gst_caps_unref (caps1);
media2 = gst_sdp_message_get_media (message, 1);
fail_unless (media1 != NULL);
caps2 = gst_sdp_media_get_caps_from_media (media2, 110);
gst_sdp_media_attributes_to_caps (media2, caps2);
result2 = gst_caps_from_string (caps_application_raptor_fec_pt_110);
fail_unless (gst_caps_is_strictly_equal (caps2, result2));
gst_caps_unref (result2);
gst_caps_unref (caps2);
gst_sdp_message_free (message);
}
GST_END_TEST
GST_START_TEST (media_from_caps_extmap_pt_100)
{
@ -715,6 +779,7 @@ sdp_suite (void)
tcase_add_test (tc_chain, caps_from_media_rtcp_fb);
tcase_add_test (tc_chain, caps_from_media_rtcp_fb_all);
tcase_add_test (tc_chain, caps_from_media_extmap);
tcase_add_test (tc_chain, caps_from_media_fmtp);
tcase_add_test (tc_chain, media_from_caps_rtcp_fb_pt_100);
tcase_add_test (tc_chain, media_from_caps_rtcp_fb_pt_101);
tcase_add_test (tc_chain, media_from_caps_extmap_pt_100);