From: Tomasz Andrzejak Date: Sat, 15 Jan 2022 18:03:33 +0000 (+0100) Subject: Add FEC SDP message test X-Git-Tag: 1.20.0~95 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5fb769e95d6c4448a3331e74807615ba7fceacad;p=platform%2Fupstream%2Fgstreamer.git Add FEC SDP message test Part-of: --- diff --git a/subprojects/gst-plugins-base/gst-libs/gst/sdp/gstsdpmessage.c b/subprojects/gst-plugins-base/gst-libs/gst/sdp/gstsdpmessage.c index 02ae031..a546647 100644 --- a/subprojects/gst-plugins-base/gst-libs/gst/sdp/gstsdpmessage.c +++ b/subprojects/gst-plugins-base/gst-libs/gst/sdp/gstsdpmessage.c @@ -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); diff --git a/subprojects/gst-plugins-base/tests/check/libs/sdp.c b/subprojects/gst-plugins-base/tests/check/libs/sdp.c index 40c3c8a..f032ac1 100644 --- a/subprojects/gst-plugins-base/tests/check/libs/sdp.c +++ b/subprojects/gst-plugins-base/tests/check/libs/sdp.c @@ -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) @@ -592,6 +620,42 @@ GST_START_TEST (caps_from_media_extmap) } 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) { GstSDPResult ret = GST_SDP_OK; @@ -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);