From: Seungha Yang Date: Mon, 27 Mar 2017 00:56:32 +0000 (+0900) Subject: mpdparser: Report error if Representation is invalid X-Git-Tag: 1.12.2~138 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a3a12d097893c1d3b650c2de0a363a63d08ad866;p=platform%2Fupstream%2Fgst-plugins-bad.git mpdparser: Report error if Representation is invalid Spec "5.3.5 Representation" is saying that id and bandwidth attributes are mandatory fields. https://bugzilla.gnome.org/show_bug.cgi?id=780569 --- diff --git a/ext/dash/gstmpdparser.c b/ext/dash/gstmpdparser.c index 9443701..2007b2a 100644 --- a/ext/dash/gstmpdparser.c +++ b/ext/dash/gstmpdparser.c @@ -1837,10 +1837,16 @@ gst_mpdparser_parse_representation_node (GList ** list, xmlNode * a_node, new_representation = g_slice_new0 (GstRepresentationNode); GST_LOG ("attributes of Representation node:"); - gst_mpdparser_get_xml_prop_string_no_whitespace (a_node, "id", - &new_representation->id); - gst_mpdparser_get_xml_prop_unsigned_integer (a_node, "bandwidth", 0, - &new_representation->bandwidth); + if (!gst_mpdparser_get_xml_prop_string_no_whitespace (a_node, "id", + &new_representation->id)) { + GST_ERROR ("Cannot parse Representation id, invalid manifest"); + return FALSE; + } + if (!gst_mpdparser_get_xml_prop_unsigned_integer (a_node, "bandwidth", 0, + &new_representation->bandwidth)) { + GST_ERROR ("Cannot parse Representation bandwidth, invalid manifest"); + return FALSE; + } gst_mpdparser_get_xml_prop_unsigned_integer (a_node, "qualityRanking", 0, &new_representation->qualityRanking); gst_mpdparser_get_xml_prop_string_vector_type (a_node, "dependencyId", diff --git a/tests/check/elements/dash_mpd.c b/tests/check/elements/dash_mpd.c index 2ab6f96..d074862 100644 --- a/tests/check/elements/dash_mpd.c +++ b/tests/check/elements/dash_mpd.c @@ -2087,7 +2087,7 @@ GST_START_TEST " profiles=\"urn:mpeg:dash:profile:isoff-main:2011\">" " " " " - " " + " " " "; gboolean ret; @@ -2125,7 +2125,7 @@ GST_START_TEST (dash_mpdparser_period_adaptationSet_representation_baseURL) " profiles=\"urn:mpeg:dash:profile:isoff-main:2011\">" " " " " - " " + " " " TestBaseURL" " "; @@ -2166,7 +2166,7 @@ GST_START_TEST " profiles=\"urn:mpeg:dash:profile:isoff-main:2011\">" " " " " - " " + " " " " " " " " - " " + " " " " " " " "; @@ -2261,7 +2261,7 @@ GST_START_TEST (dash_mpdparser_period_adaptationSet_representation_segmentBase) " profiles=\"urn:mpeg:dash:profile:isoff-main:2011\">" " " " " - " " + " " " " " " " "; @@ -2300,7 +2300,7 @@ GST_START_TEST (dash_mpdparser_period_adaptationSet_representation_segmentList) " profiles=\"urn:mpeg:dash:profile:isoff-main:2011\">" " " " " - " " + " " " " " " " "; @@ -2339,7 +2339,7 @@ GST_START_TEST " profiles=\"urn:mpeg:dash:profile:isoff-main:2011\">" " " " " - " " + " " " " " " " "; @@ -2677,13 +2677,13 @@ GST_START_TEST (dash_mpdparser_bitstreamSwitching_inheritance) " bitstreamSwitching=\"true\">" " " - " " + " " " " " " " " - " " + " " " "; gboolean ret; @@ -2888,7 +2888,7 @@ GST_START_TEST (dash_mpdparser_setup_streaming) " duration=\"P0Y0M1DT1H1M1S\">" " " - " " + " " " "; gboolean ret; @@ -3209,15 +3209,15 @@ GST_START_TEST (dash_mpdparser_activeStream_selection) " profiles=\"urn:mpeg:dash:profile:isoff-main:2011\">" " " " " - " " + " " " " " " " " - " " + " " " " " " " " - " " + " " " "; gboolean ret; @@ -3320,7 +3320,7 @@ GST_START_TEST (dash_mpdparser_activeStream_parameters) " height=\"240\"" " bitstreamSwitching=\"true\"" " audioSamplingRate=\"48000\">" - " " + " " " "; gboolean ret; @@ -3401,15 +3401,15 @@ GST_START_TEST (dash_mpdparser_get_audio_languages) " profiles=\"urn:mpeg:dash:profile:isoff-main:2011\">" " " " " - " " + " " " " " " " " - " " + " " " " " " " " - " " + " " " "; gboolean ret; @@ -3505,7 +3505,7 @@ GST_START_TEST (dash_mpdparser_get_baseURL1) " http://example.com/" " " " " - " " + " " " "; GstMpdClient *mpdclient = setup_mpd_client (xml); @@ -3532,7 +3532,7 @@ GST_START_TEST (dash_mpdparser_get_baseURL2) " /period_base_url/" " " " adaptation_base_url" - " " + " " " representation_base_url" " "; @@ -3574,7 +3574,7 @@ GST_START_TEST (dash_mpdparser_get_baseURL3) " /period_base_url/" " " " adaptation_base_url" - " " + " " " /representation_base_url" " "; @@ -3614,7 +3614,7 @@ GST_START_TEST (dash_mpdparser_get_baseURL4) " /period_base_url/" " " " adaptation_base_url/" - " " + " " " representation_base_url/" " "; @@ -3666,7 +3666,7 @@ GST_START_TEST (dash_mpdparser_get_baseURL5) " adaptation_base_url2/" " adaptation_base_url3/" " adaptation_base_url4/" - " " + " " " representation_base_url1/" " representation_base_url2/" " representation_base_url3/" @@ -3748,7 +3748,7 @@ GST_START_TEST (dash_mpdparser_get_baseURL6) " profiles=\"urn:mpeg:dash:profile:isoff-main:2011\">" " " " " - " " + " " " "; GstMpdClient *mpdclient = setup_mpd_client (xml); @@ -3773,7 +3773,7 @@ GST_START_TEST (dash_mpdparser_get_baseURL7) " x/example.com/" " " " " - " " + " " " "; GstMpdClient *mpdclient; @@ -3801,7 +3801,7 @@ GST_START_TEST (dash_mpdparser_get_baseURL8) " x:y/example.com/" " " " " - " " + " " " "; GstMpdClient *mpdclient = setup_mpd_client (xml); @@ -3862,7 +3862,7 @@ GST_START_TEST (dash_mpdparser_get_streamPresentationOffset) " " " " " " - " " + " " " "; gboolean ret; @@ -3921,7 +3921,7 @@ GST_START_TEST (dash_mpdparser_segments) " mediaPresentationDuration=\"P0Y0M0DT3H3M30S\">" " " " " - " " + " " " " " " " " " " - " " + " " " " " " @@ -4144,7 +4144,7 @@ GST_START_TEST (dash_mpdparser_fragments) " mediaPresentationDuration=\"P0Y0M0DT3H3M30S\">" " " " " - " " + " " " "; gboolean ret; @@ -4228,7 +4228,7 @@ GST_START_TEST (dash_mpdparser_inherited_segmentBase) " " " " " " - " " + " " " " " " " "; @@ -4286,7 +4286,7 @@ GST_START_TEST (dash_mpdparser_inherited_segmentURL) " indexRange=\"30-40\">" " " " " - " " + " " " " " " " " " " - " " + " " " " " " " " " " - " " + " " " " " " " " @@ -4753,7 +4753,7 @@ GST_START_TEST (dash_mpdparser_multiple_inherited_segmentURL) " index=\"TestIndex1\" indexRange=\"200-300\"" " >" " " - " " + " " " " " " "" " " - " " + " " " " " " - " " + " " " " " " " "; @@ -5321,7 +5321,7 @@ GST_START_TEST (dash_mpdparser_unmatched_segmentTimeline_segmentURL) " mediaPresentationDuration=\"P0Y0M0DT3H3M30S\">" " " " " - " " + " " " " " " " "