From a9b039c3f93eadddde38bebc0741a5e6086c8072 Mon Sep 17 00:00:00 2001 From: Rintaro Kuroiwa Date: Mon, 4 Jan 2016 14:21:01 -0800 Subject: [PATCH] Fix MPD validation problems - Replaced urn:mpeg:DASH:schema:MPD:2011 with urn:mpeg:dash:schema:mpd:2011. The former is from the old spec. - Replaced the MPD schema with the latest one. - Fixed subSegmentAlignment typo with subsegmentAlignment. Issue #55 Change-Id: Icffa9872ffc462627b81900a48f59e7b76687c11 --- .../testdata/bear-640x360-av-cenc-golden.mpd | 6 +- .../bear-640x360-av-cenc-iop-golden.mpd | 6 +- .../test/testdata/bear-640x360-av-golden.mpd | 6 +- .../bear-640x360-av-live-cenc-golden.mpd | 2 +- .../bear-640x360-av-live-cenc-iop-golden.mpd | 2 +- ...r-640x360-av-live-cenc-rotation-golden.mpd | 2 +- ...0x360-av-live-cenc-rotation-iop-golden.mpd | 2 +- .../testdata/bear-640x360-av-live-golden.mpd | 2 +- .../test/testdata/bear-640x360-avt-golden.mpd | 6 +- .../bear-640x360-hevc-v-cenc-golden.mpd | 4 +- .../test/testdata/bear-640x360-v-golden.mpd | 4 +- .../testdata/subtitle-english-vtt-golden.mpd | 2 +- packager/mpd/base/mpd_builder.cc | 8 +- packager/mpd/base/mpd_builder.h | 2 +- packager/mpd/base/mpd_builder_unittest.cc | 66 +- .../audio_media_info1_expected_mpd_output.txt | 2 +- ..._video_media_info1_expected_mpd_output.txt | 2 +- packager/mpd/test/data/dynamic_normal_mpd.txt | 2 +- ...ypted_audio_media_info_expected_output.txt | 2 +- ...guage_audio_media_info_expected_output.txt | 2 +- .../video_media_info1_expected_mpd_output.txt | 2 +- ...eo_media_info1and2_expected_mpd_output.txt | 2 +- packager/mpd/test/schema/DASH-MPD.xsd | 817 +++++++++--------- 23 files changed, 494 insertions(+), 457 deletions(-) diff --git a/packager/app/test/testdata/bear-640x360-av-cenc-golden.mpd b/packager/app/test/testdata/bear-640x360-av-cenc-golden.mpd index c17ef2da20..c2581f9708 100644 --- a/packager/app/test/testdata/bear-640x360-av-cenc-golden.mpd +++ b/packager/app/test/testdata/bear-640x360-av-cenc-golden.mpd @@ -1,7 +1,7 @@ - + - + @@ -13,7 +13,7 @@ - + diff --git a/packager/app/test/testdata/bear-640x360-av-cenc-iop-golden.mpd b/packager/app/test/testdata/bear-640x360-av-cenc-iop-golden.mpd index f3e42ecf8b..cd8f6f195c 100644 --- a/packager/app/test/testdata/bear-640x360-av-cenc-iop-golden.mpd +++ b/packager/app/test/testdata/bear-640x360-av-cenc-iop-golden.mpd @@ -1,7 +1,7 @@ - + - + AAAAMHBzc2gAAAAA7e+LqXnWSs6jyCfc1R0h7QAAABAxMjM0NTY3ODkwMTIzNDU2 @@ -13,7 +13,7 @@ - + AAAAMHBzc2gAAAAA7e+LqXnWSs6jyCfc1R0h7QAAABAxMjM0NTY3ODkwMTIzNDU2 diff --git a/packager/app/test/testdata/bear-640x360-av-golden.mpd b/packager/app/test/testdata/bear-640x360-av-golden.mpd index 4a6337e6ce..64553814d7 100644 --- a/packager/app/test/testdata/bear-640x360-av-golden.mpd +++ b/packager/app/test/testdata/bear-640x360-av-golden.mpd @@ -1,7 +1,7 @@ - + - + output_video.mp4 @@ -9,7 +9,7 @@ - + output_audio.mp4 diff --git a/packager/app/test/testdata/bear-640x360-av-live-cenc-golden.mpd b/packager/app/test/testdata/bear-640x360-av-live-cenc-golden.mpd index e03f52cbad..b69a174e60 100644 --- a/packager/app/test/testdata/bear-640x360-av-live-cenc-golden.mpd +++ b/packager/app/test/testdata/bear-640x360-av-live-cenc-golden.mpd @@ -1,5 +1,5 @@ - + diff --git a/packager/app/test/testdata/bear-640x360-av-live-cenc-iop-golden.mpd b/packager/app/test/testdata/bear-640x360-av-live-cenc-iop-golden.mpd index 4a0f2323f5..e1f097e3a3 100644 --- a/packager/app/test/testdata/bear-640x360-av-live-cenc-iop-golden.mpd +++ b/packager/app/test/testdata/bear-640x360-av-live-cenc-iop-golden.mpd @@ -1,5 +1,5 @@ - + diff --git a/packager/app/test/testdata/bear-640x360-av-live-cenc-rotation-golden.mpd b/packager/app/test/testdata/bear-640x360-av-live-cenc-rotation-golden.mpd index beeab750a4..80a3fa0c3f 100644 --- a/packager/app/test/testdata/bear-640x360-av-live-cenc-rotation-golden.mpd +++ b/packager/app/test/testdata/bear-640x360-av-live-cenc-rotation-golden.mpd @@ -1,5 +1,5 @@ - + diff --git a/packager/app/test/testdata/bear-640x360-av-live-cenc-rotation-iop-golden.mpd b/packager/app/test/testdata/bear-640x360-av-live-cenc-rotation-iop-golden.mpd index 01b835f4dc..18b72a84e9 100644 --- a/packager/app/test/testdata/bear-640x360-av-live-cenc-rotation-iop-golden.mpd +++ b/packager/app/test/testdata/bear-640x360-av-live-cenc-rotation-iop-golden.mpd @@ -1,5 +1,5 @@ - + diff --git a/packager/app/test/testdata/bear-640x360-av-live-golden.mpd b/packager/app/test/testdata/bear-640x360-av-live-golden.mpd index 3c28adb9b1..7d9a0d3e3a 100644 --- a/packager/app/test/testdata/bear-640x360-av-live-golden.mpd +++ b/packager/app/test/testdata/bear-640x360-av-live-golden.mpd @@ -1,5 +1,5 @@ - + diff --git a/packager/app/test/testdata/bear-640x360-avt-golden.mpd b/packager/app/test/testdata/bear-640x360-avt-golden.mpd index 81e9c0b82c..d8308d3595 100644 --- a/packager/app/test/testdata/bear-640x360-avt-golden.mpd +++ b/packager/app/test/testdata/bear-640x360-avt-golden.mpd @@ -1,12 +1,12 @@ - + output_text.vtt - + output_video.mp4 @@ -14,7 +14,7 @@ - + output_audio.mp4 diff --git a/packager/app/test/testdata/bear-640x360-hevc-v-cenc-golden.mpd b/packager/app/test/testdata/bear-640x360-hevc-v-cenc-golden.mpd index 391d6e2850..8e7c701a31 100644 --- a/packager/app/test/testdata/bear-640x360-hevc-v-cenc-golden.mpd +++ b/packager/app/test/testdata/bear-640x360-hevc-v-cenc-golden.mpd @@ -1,7 +1,7 @@ - + - + diff --git a/packager/app/test/testdata/bear-640x360-v-golden.mpd b/packager/app/test/testdata/bear-640x360-v-golden.mpd index 0b358325e0..ea6a74ba36 100644 --- a/packager/app/test/testdata/bear-640x360-v-golden.mpd +++ b/packager/app/test/testdata/bear-640x360-v-golden.mpd @@ -1,7 +1,7 @@ - + - + output_0.mp4 diff --git a/packager/app/test/testdata/subtitle-english-vtt-golden.mpd b/packager/app/test/testdata/subtitle-english-vtt-golden.mpd index 69b6177392..d6f20ee8c3 100644 --- a/packager/app/test/testdata/subtitle-english-vtt-golden.mpd +++ b/packager/app/test/testdata/subtitle-english-vtt-golden.mpd @@ -1,5 +1,5 @@ - + diff --git a/packager/mpd/base/mpd_builder.cc b/packager/mpd/base/mpd_builder.cc index 13f031c21e..e1befa5bd3 100644 --- a/packager/mpd/base/mpd_builder.cc +++ b/packager/mpd/base/mpd_builder.cc @@ -77,12 +77,12 @@ std::string GetMimeType(const std::string& prefix, void AddMpdNameSpaceInfo(XmlNode* mpd) { DCHECK(mpd); - static const char kXmlNamespace[] = "urn:mpeg:DASH:schema:MPD:2011"; + static const char kXmlNamespace[] = "urn:mpeg:dash:schema:mpd:2011"; static const char kXmlNamespaceXsi[] = "http://www.w3.org/2001/XMLSchema-instance"; static const char kXmlNamespaceXlink[] = "http://www.w3.org/1999/xlink"; static const char kDashSchemaMpd2011[] = - "urn:mpeg:DASH:schema:MPD:2011 DASH-MPD.xsd"; + "urn:mpeg:dash:schema:mpd:2011 DASH-MPD.xsd"; static const char kCencNamespace[] = "urn:mpeg:cenc:2013"; mpd->SetStringAttribute("xmlns", kXmlNamespace); @@ -780,7 +780,7 @@ xml::scoped_xml_ptr AdaptationSet::GetXml() { if (segments_aligned_ == kSegmentAlignmentTrue) { adaptation_set.SetStringAttribute(mpd_type_ == MpdBuilder::kStatic - ? "subSegmentAlignment" + ? "subsegmentAlignment" : "segmentAlignment", "true"); } @@ -810,7 +810,7 @@ int AdaptationSet::Group() const { // Check segmentAlignment for Live here. Storing all start_time and duration // will out-of-memory because there's no way of knowing when it will end. -// VOD subSegmentAlignment check is *not* done here because it is possible +// VOD subsegmentAlignment check is *not* done here because it is possible // that some Representations might not have been added yet (e.g. a thread is // assigned per muxer so one might run faster than others). // To be clear, for Live, all Representations should be added before a diff --git a/packager/mpd/base/mpd_builder.h b/packager/mpd/base/mpd_builder.h index 784959fd8a..d296bbfc1b 100644 --- a/packager/mpd/base/mpd_builder.h +++ b/packager/mpd/base/mpd_builder.h @@ -449,7 +449,7 @@ class Representation { const std::string& pssh); /// Add a media (sub)segment to the representation. - /// AdaptationSet@{subSegmentAlignment,segmentAlignment} cannot be set + /// AdaptationSet@{subsegmentAlignment,segmentAlignment} cannot be set /// if this is not called for all Representations. /// @param start_time is the start time for the (sub)segment, in units of the /// stream's time scale. diff --git a/packager/mpd/base/mpd_builder_unittest.cc b/packager/mpd/base/mpd_builder_unittest.cc index 4feb25a083..5af5818a8d 100644 --- a/packager/mpd/base/mpd_builder_unittest.cc +++ b/packager/mpd/base/mpd_builder_unittest.cc @@ -248,10 +248,10 @@ class SegmentTemplateTest : public DynamicMpdBuilderTest { // always has segmentAligntment=true. const char kOutputTemplate[] = "\n" - "\n" " \n" @@ -333,10 +333,10 @@ class TimeShiftBufferDepthTest : public SegmentTemplateTest { // always has segmentAligntment=true. const char kOutputTemplate[] = "\n" - "\n" @@ -712,10 +712,10 @@ TEST_F(CommonMpdBuilderTest, AdaptationAddRoleElementMain) { // MPD without adding any Representations. const char kExpectedOutput[] = "\n" - "\n" @@ -755,10 +755,10 @@ TEST_F(CommonMpdBuilderTest, CheckContentProtectionRoleRepresentationOrder) { xml::scoped_xml_ptr adaptation_set_xml(adaptation_set->GetXml()); const char kExpectedOutput[] = "\n" - "\n" @@ -1101,11 +1101,11 @@ TEST_F(CommonMpdBuilderTest, ExpectAttributeNotSet("frameRate", adaptation_set_xml.get())); } -// Verify that subSegmentAlignment is set to true if all the Representations' +// Verify that subsegmentAlignment is set to true if all the Representations' // segments are aligned and the MPD type is static. // Also checking that not all Representations have to be added before calling // AddNewSegment() on a Representation. -TEST_F(StaticMpdBuilderTest, SubSegmentAlignment) { +TEST_F(StaticMpdBuilderTest, subsegmentAlignment) { base::AtomicSequenceNumber sequence_counter; const char k480pMediaInfo[] = "video_info {\n" @@ -1130,7 +1130,7 @@ TEST_F(StaticMpdBuilderTest, SubSegmentAlignment) { "}\n" "container_type: 1\n"; - // First use same start time and duration, and verify that subSegmentAlignment + // First use same start time and duration, and verify that subsegmentAlignment // is set to true. const uint64_t kStartTime = 0u; const uint64_t kDuration = 10u; @@ -1151,13 +1151,13 @@ TEST_F(StaticMpdBuilderTest, SubSegmentAlignment) { xml::scoped_xml_ptr aligned(adaptation_set->GetXml()); EXPECT_NO_FATAL_FAILURE( - ExpectAttributeEqString("subSegmentAlignment", "true", aligned.get())); + ExpectAttributeEqString("subsegmentAlignment", "true", aligned.get())); // Unknown because 480p has an extra subsegments. representation_480p->AddNewSegment(11, 20, kAnySize); xml::scoped_xml_ptr alignment_unknown(adaptation_set->GetXml()); EXPECT_NO_FATAL_FAILURE( - ExpectAttributeNotSet("subSegmentAlignment", alignment_unknown.get())); + ExpectAttributeNotSet("subsegmentAlignment", alignment_unknown.get())); // Add segments that make them not aligned. representation_360p->AddNewSegment(10, 1, kAnySize); @@ -1165,11 +1165,11 @@ TEST_F(StaticMpdBuilderTest, SubSegmentAlignment) { xml::scoped_xml_ptr unaligned(adaptation_set->GetXml()); EXPECT_NO_FATAL_FAILURE( - ExpectAttributeNotSet("subSegmentAlignment", unaligned.get())); + ExpectAttributeNotSet("subsegmentAlignment", unaligned.get())); } -// Verify that subSegmentAlignment can be force set to true. -TEST_F(StaticMpdBuilderTest, ForceSetSubSegmentAlignment) { +// Verify that subsegmentAlignment can be force set to true. +TEST_F(StaticMpdBuilderTest, ForceSetsubsegmentAlignment) { base::AtomicSequenceNumber sequence_counter; const char k480pMediaInfo[] = "video_info {\n" @@ -1211,13 +1211,13 @@ TEST_F(StaticMpdBuilderTest, ForceSetSubSegmentAlignment) { representation_360p->AddNewSegment(kStartTime2, kDuration, kAnySize); xml::scoped_xml_ptr unaligned(adaptation_set->GetXml()); EXPECT_NO_FATAL_FAILURE( - ExpectAttributeNotSet("subSegmentAlignment", unaligned.get())); + ExpectAttributeNotSet("subsegmentAlignment", unaligned.get())); // Then force set the segment alignment attribute to true. adaptation_set->ForceSetSegmentAlignment(true); xml::scoped_xml_ptr aligned(adaptation_set->GetXml()); EXPECT_NO_FATAL_FAILURE( - ExpectAttributeEqString("subSegmentAlignment", "true", aligned.get())); + ExpectAttributeEqString("subsegmentAlignment", "true", aligned.get())); } // Verify that segmentAlignment is set to true if all the Representations @@ -1272,7 +1272,7 @@ TEST_F(DynamicMpdBuilderTest, SegmentAlignment) { xml::scoped_xml_ptr unaligned(adaptation_set->GetXml()); EXPECT_NO_FATAL_FAILURE( - ExpectAttributeNotSet("subSegmentAlignment", unaligned.get())); + ExpectAttributeNotSet("subsegmentAlignment", unaligned.get())); } // Verify that the width and height attribute are set if all the video @@ -1429,11 +1429,11 @@ TEST_F(CommonMpdBuilderTest, AdaptationSetAddContentProtectionAndUpdate) { const char kExpectedOutput1[] = "\n" - "" @@ -1459,11 +1459,11 @@ TEST_F(CommonMpdBuilderTest, AdaptationSetAddContentProtectionAndUpdate) { "edef8ba9-79d6-4ace-a3c8-27dcd51d21ed", "new pssh value"); const char kExpectedOutput2[] = "\n" - "" @@ -1515,11 +1515,11 @@ TEST_F(CommonMpdBuilderTest, UpdateToRemovePsshElement) { const char kExpectedOutput1[] = "\n" - "" @@ -1545,11 +1545,11 @@ TEST_F(CommonMpdBuilderTest, UpdateToRemovePsshElement) { "added pssh value"); const char kExpectedOutput2[] = "\n" - "" @@ -1631,11 +1631,11 @@ TEST_F(StaticMpdBuilderTest, AudioChannelConfigurationWithContentProtection) { const char kExpectedOutput[] = "\n" - "" @@ -1731,11 +1731,11 @@ TEST_F(StaticMpdBuilderTest, Text) { const char kExpectedOutput[] = "\n" - "" @@ -1770,11 +1770,11 @@ TEST_F(StaticMpdBuilderTest, Text) { TEST_F(DynamicMpdBuilderTest, CheckMpdAttributes) { static const char kExpectedOutput[] = "\n" - " - + diff --git a/packager/mpd/test/data/audio_media_info1_video_media_info1_expected_mpd_output.txt b/packager/mpd/test/data/audio_media_info1_video_media_info1_expected_mpd_output.txt index 9b34c03422..a058d16dec 100644 --- a/packager/mpd/test/data/audio_media_info1_video_media_info1_expected_mpd_output.txt +++ b/packager/mpd/test/data/audio_media_info1_video_media_info1_expected_mpd_output.txt @@ -1,5 +1,5 @@ - + diff --git a/packager/mpd/test/data/dynamic_normal_mpd.txt b/packager/mpd/test/data/dynamic_normal_mpd.txt index a379db8ac7..c15790b1b3 100644 --- a/packager/mpd/test/data/dynamic_normal_mpd.txt +++ b/packager/mpd/test/data/dynamic_normal_mpd.txt @@ -1,5 +1,5 @@ - + diff --git a/packager/mpd/test/data/encrypted_audio_media_info_expected_output.txt b/packager/mpd/test/data/encrypted_audio_media_info_expected_output.txt index 0922e6838d..730571ba7a 100644 --- a/packager/mpd/test/data/encrypted_audio_media_info_expected_output.txt +++ b/packager/mpd/test/data/encrypted_audio_media_info_expected_output.txt @@ -1,5 +1,5 @@ - + diff --git a/packager/mpd/test/data/language_audio_media_info_expected_output.txt b/packager/mpd/test/data/language_audio_media_info_expected_output.txt index 3b21dd5494..1e6aa020cd 100644 --- a/packager/mpd/test/data/language_audio_media_info_expected_output.txt +++ b/packager/mpd/test/data/language_audio_media_info_expected_output.txt @@ -1,5 +1,5 @@ - + diff --git a/packager/mpd/test/data/video_media_info1_expected_mpd_output.txt b/packager/mpd/test/data/video_media_info1_expected_mpd_output.txt index 22b68f4714..c0411ce5ec 100644 --- a/packager/mpd/test/data/video_media_info1_expected_mpd_output.txt +++ b/packager/mpd/test/data/video_media_info1_expected_mpd_output.txt @@ -1,5 +1,5 @@ - + diff --git a/packager/mpd/test/data/video_media_info1and2_expected_mpd_output.txt b/packager/mpd/test/data/video_media_info1and2_expected_mpd_output.txt index 54f0e2b9f7..f94133f24b 100644 --- a/packager/mpd/test/data/video_media_info1and2_expected_mpd_output.txt +++ b/packager/mpd/test/data/video_media_info1and2_expected_mpd_output.txt @@ -1,5 +1,5 @@ - + diff --git a/packager/mpd/test/schema/DASH-MPD.xsd b/packager/mpd/test/schema/DASH-MPD.xsd index e0eeeddaeb..1c8a7ac67c 100644 --- a/packager/mpd/test/schema/DASH-MPD.xsd +++ b/packager/mpd/test/schema/DASH-MPD.xsd @@ -1,390 +1,427 @@ - - - - - - - Media Presentation Description - - This Schema defines the Media Presentation Description for MPEG-DASH. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + Media Presentation Description + + This Schema defines the Media Presentation Description for MPEG-DASH. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +