summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAlex Ashley <bugzilla@ashley-family.net>2015-08-19 11:29:43 +0100
committerSebastian Dröge <sebastian@centricular.com>2015-08-19 16:30:58 +0300
commit2ebebdbfbb7f5cfa7b438bb6b02fc723c9349d51 (patch)
tree84852700a20d47fd9e7d30d3c68db95e4b85ec0f /tests
parent626bd97c5aa886444ed21d6fb86467d0eeb9857e (diff)
downloadgstreamer-plugins-bad-2ebebdbfbb7f5cfa7b438bb6b02fc723c9349d51.tar.gz
dashdemux: replace xmlNodeDump with xmlNodeDumpOutput
When running on an STB, the function gst_mpdparser_get_xml_node_as_string causes a segmentation fault. This code works correctly on a Linux desktop. Looking at the libxml documentation, the xmlNodeDump is deprecated. Replacing the use of xmlNodeDump with xmlNodeDumpOutput fixes the segfault on the STB and removes the use of the deprecated function.
Diffstat (limited to 'tests')
-rw-r--r--tests/check/elements/dash_mpd.c61
1 files changed, 61 insertions, 0 deletions
diff --git a/tests/check/elements/dash_mpd.c b/tests/check/elements/dash_mpd.c
index ee5b6cbbd..bbf27aa98 100644
--- a/tests/check/elements/dash_mpd.c
+++ b/tests/check/elements/dash_mpd.c
@@ -1272,6 +1272,66 @@ GST_START_TEST
GST_END_TEST;
/*
+ * Test parsing ContentProtection element that has no value attribute
+ */
+GST_START_TEST (dash_mpdparser_contentProtection_no_value)
+{
+ GstPeriodNode *periodNode;
+ GstAdaptationSetNode *adaptationSet;
+ GstRepresentationBaseType *representationBase;
+ GstDescriptorType *contentProtection;
+ const gchar *xml =
+ "<?xml version=\"1.0\"?>"
+ "<MPD xmlns=\"urn:mpeg:dash:schema:mpd:2011\""
+ " profiles=\"urn:mpeg:dash:profile:isoff-main:2011\">"
+ " <Period>"
+ " <AdaptationSet>"
+ " <ContentProtection schemeIdUri=\"urn:mpeg:dash:mp4protection:2011\" value=\"cenc\"/>"
+ " <ContentProtection xmlns:mas=\"urn:marlin:mas:1-0:services:schemas:mpd\" schemeIdUri=\"urn:uuid:5e629af5-38da-4063-8977-97ffbd9902d4\">"
+ " <mas:MarlinContentIds>"
+ " <mas:MarlinContentId>urn:marlin:kid:02020202020202020202020202020202</mas:MarlinContentId>"
+ " </mas:MarlinContentIds>"
+ " </ContentProtection>" "</AdaptationSet></Period></MPD>";
+
+ gboolean ret;
+ GstMpdClient *mpdclient = gst_mpd_client_new ();
+ gchar *str;
+
+ ret = gst_mpd_parse (mpdclient, xml, (gint) strlen (xml));
+ assert_equals_int (ret, TRUE);
+
+ periodNode = (GstPeriodNode *) mpdclient->mpd_node->Periods->data;
+ adaptationSet = (GstAdaptationSetNode *) periodNode->AdaptationSets->data;
+ representationBase = adaptationSet->RepresentationBase;
+ assert_equals_int (g_list_length (representationBase->ContentProtection), 2);
+ contentProtection =
+ (GstDescriptorType *) g_list_nth (representationBase->ContentProtection,
+ 1)->data;
+ assert_equals_string (contentProtection->schemeIdUri,
+ "urn:uuid:5e629af5-38da-4063-8977-97ffbd9902d4");
+ fail_if (contentProtection->value == NULL);
+ g_print ("%s\n", contentProtection->value);
+ /* We can't do a simple compare of value (which should be an XML dump
+ of the ContentProtection element), because the whitespace
+ formatting from xmlDump might differ between versions of libxml */
+ str = strstr (contentProtection->value, "<ContentProtection");
+ fail_if (str == NULL);
+ str = strstr (contentProtection->value, "<mas:MarlinContentIds>");
+ fail_if (str == NULL);
+ str = strstr (contentProtection->value, "<mas:MarlinContentId>");
+ fail_if (str == NULL);
+ str =
+ strstr (contentProtection->value,
+ "urn:marlin:kid:02020202020202020202020202020202");
+ fail_if (str == NULL);
+ str = strstr (contentProtection->value, "</ContentProtection>");
+ fail_if (str == NULL);
+ gst_mpd_client_free (mpdclient);
+}
+
+GST_END_TEST;
+
+/*
* Test parsing Period AdaptationSet Accessibility attributes
*
*/
@@ -4344,6 +4404,7 @@ dash_suite (void)
dash_mpdparser_period_adaptationSet_representationBase_audioChannelConfiguration);
tcase_add_test (tc_simpleMPD,
dash_mpdparser_period_adaptationSet_representationBase_contentProtection);
+ tcase_add_test (tc_simpleMPD, dash_mpdparser_contentProtection_no_value);
tcase_add_test (tc_simpleMPD,
dash_mpdparser_period_adaptationSet_accessibility);
tcase_add_test (tc_simpleMPD, dash_mpdparser_period_adaptationSet_role);