Fixed a Opus in Mp4 parsing problem
- Also added end to end test in packager_test.py Closes Issue #83 Change-Id: I7a8e695a36e654507b75d558710db1ce8867a916
This commit is contained in:
parent
32482c0bce
commit
579678d6a6
|
@ -103,11 +103,10 @@ class PackagerAppTest(unittest.TestCase):
|
|||
def testPackageAvcTs(self):
|
||||
# Currently we only support live packaging for ts.
|
||||
self.packager.Package(
|
||||
self._GetStreams(
|
||||
['audio', 'video'],
|
||||
output_format='ts',
|
||||
live=True,
|
||||
test_files=['bear-640x360.ts']),
|
||||
self._GetStreams(['audio', 'video'],
|
||||
output_format='ts',
|
||||
live=True,
|
||||
test_files=['bear-640x360.ts']),
|
||||
self._GetFlags(live=True))
|
||||
self._DiffLiveGold(self.output[0],
|
||||
'bear-640x360-a-golden',
|
||||
|
@ -129,10 +128,9 @@ class PackagerAppTest(unittest.TestCase):
|
|||
|
||||
def testPackageVp9Webm(self):
|
||||
self.packager.Package(
|
||||
self._GetStreams(
|
||||
['audio', 'video'],
|
||||
output_format='webm',
|
||||
test_files=['bear-320x240-vp9-opus.webm']),
|
||||
self._GetStreams(['audio', 'video'],
|
||||
output_format='webm',
|
||||
test_files=['bear-320x240-vp9-opus.webm']),
|
||||
self._GetFlags())
|
||||
self._DiffGold(self.output[0], 'bear-320x240-opus-golden.webm')
|
||||
self._DiffGold(self.output[1], 'bear-320x240-vp9-golden.webm')
|
||||
|
@ -219,15 +217,17 @@ class PackagerAppTest(unittest.TestCase):
|
|||
self._DiffGold(self.mpd_output, 'bear-640x360-vp8-cenc-golden.mpd')
|
||||
self._VerifyDecryption(self.output[0], 'bear-640x360-vp8-golden.mp4')
|
||||
|
||||
def testPackageVp9Mp4WithEncryption(self):
|
||||
def testPackageOpusVp9Mp4WithEncryption(self):
|
||||
self.packager.Package(
|
||||
self._GetStreams(['video'],
|
||||
self._GetStreams(['audio', 'video'],
|
||||
output_format='mp4',
|
||||
test_files=['bear-320x240-vp9-opus.webm']),
|
||||
self._GetFlags(encryption=True))
|
||||
self._DiffGold(self.output[0], 'bear-320x240-vp9-cenc-golden.mp4')
|
||||
self._DiffGold(self.mpd_output, 'bear-320x240-vp9-cenc-golden.mpd')
|
||||
self._VerifyDecryption(self.output[0], 'bear-320x240-vp9-golden.mp4')
|
||||
self._DiffGold(self.output[0], 'bear-320x240-opus-cenc-golden.mp4')
|
||||
self._DiffGold(self.output[1], 'bear-320x240-vp9-cenc-golden.mp4')
|
||||
self._DiffGold(self.mpd_output, 'bear-320x240-opus-vp9-cenc-golden.mpd')
|
||||
self._VerifyDecryption(self.output[0], 'bear-320x240-opus-golden.mp4')
|
||||
self._VerifyDecryption(self.output[1], 'bear-320x240-vp9-golden.mp4')
|
||||
|
||||
def testPackageWithEncryptionAndRandomIv(self):
|
||||
self.packager.Package(
|
||||
|
@ -280,8 +280,7 @@ class PackagerAppTest(unittest.TestCase):
|
|||
|
||||
def testPackageWithLiveProfile(self):
|
||||
self.packager.Package(
|
||||
self._GetStreams(
|
||||
['audio', 'video'], live=True),
|
||||
self._GetStreams(['audio', 'video'], live=True),
|
||||
self._GetFlags(live=True))
|
||||
self._DiffLiveGold(self.output[0], 'bear-640x360-a-live-golden')
|
||||
self._DiffLiveGold(self.output[1], 'bear-640x360-v-live-golden')
|
||||
|
@ -289,8 +288,7 @@ class PackagerAppTest(unittest.TestCase):
|
|||
|
||||
def testPackageWithLiveProfileAndEncryption(self):
|
||||
self.packager.Package(
|
||||
self._GetStreams(
|
||||
['audio', 'video'], live=True),
|
||||
self._GetStreams(['audio', 'video'], live=True),
|
||||
self._GetFlags(encryption=True, live=True))
|
||||
self._DiffLiveGold(self.output[0], 'bear-640x360-a-live-cenc-golden')
|
||||
self._DiffLiveGold(self.output[1], 'bear-640x360-v-live-cenc-golden')
|
||||
|
@ -299,8 +297,7 @@ class PackagerAppTest(unittest.TestCase):
|
|||
|
||||
def testPackageWithLiveProfileAndEncryptionAndDashIfIop(self):
|
||||
self.packager.Package(
|
||||
self._GetStreams(
|
||||
['audio', 'video'], live=True),
|
||||
self._GetStreams(['audio', 'video'], live=True),
|
||||
self._GetFlags(encryption=True,
|
||||
live=True, dash_if_iop=True))
|
||||
self._DiffLiveGold(self.output[0], 'bear-640x360-a-live-cenc-golden')
|
||||
|
@ -310,11 +307,10 @@ class PackagerAppTest(unittest.TestCase):
|
|||
|
||||
def testPackageWithLiveProfileAndEncryptionAndDashIfIopWithMultFiles(self):
|
||||
self.packager.Package(
|
||||
self._GetStreams(
|
||||
['audio', 'video'],
|
||||
live=True,
|
||||
test_files=['bear-1280x720.mp4', 'bear-640x360.mp4',
|
||||
'bear-320x180.mp4']),
|
||||
self._GetStreams(['audio', 'video'],
|
||||
live=True,
|
||||
test_files=['bear-1280x720.mp4', 'bear-640x360.mp4',
|
||||
'bear-320x180.mp4']),
|
||||
self._GetFlags(encryption=True,
|
||||
live=True, dash_if_iop=True))
|
||||
self._DiffLiveGold(self.output[2], 'bear-640x360-a-live-cenc-golden')
|
||||
|
@ -325,8 +321,7 @@ class PackagerAppTest(unittest.TestCase):
|
|||
|
||||
def testPackageWithLiveProfileAndKeyRotation(self):
|
||||
self.packager.Package(
|
||||
self._GetStreams(
|
||||
['audio', 'video'], live=True),
|
||||
self._GetStreams(['audio', 'video'], live=True),
|
||||
self._GetFlags(encryption=True,
|
||||
key_rotation=True,
|
||||
live=True))
|
||||
|
@ -339,8 +334,7 @@ class PackagerAppTest(unittest.TestCase):
|
|||
|
||||
def testPackageWithLiveProfileAndKeyRotationAndDashIfIop(self):
|
||||
self.packager.Package(
|
||||
self._GetStreams(
|
||||
['audio', 'video'], live=True),
|
||||
self._GetStreams(['audio', 'video'], live=True),
|
||||
self._GetFlags(encryption=True,
|
||||
key_rotation=True,
|
||||
live=True,
|
||||
|
@ -492,11 +486,11 @@ class PackagerAppTest(unittest.TestCase):
|
|||
else:
|
||||
match = filecmp.cmp(test_output, golden_file)
|
||||
if not match:
|
||||
p = subprocess.Popen(
|
||||
['git', '--no-pager', 'diff', '--color=auto', '--no-ext-diff',
|
||||
'--no-index', golden_file, test_output],
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE)
|
||||
p = subprocess.Popen(['git', '--no-pager', 'diff', '--color=auto',
|
||||
'--no-ext-diff', '--no-index', golden_file,
|
||||
test_output],
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE)
|
||||
output, error = p.communicate()
|
||||
self.fail(output + error)
|
||||
|
||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -1,9 +1,22 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--Generated with https://github.com/google/shaka-packager version <tag>-<hash>-<test>-->
|
||||
<MPD xmlns="urn:mpeg:dash:schema:mpd:2011" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xlink="http://www.w3.org/1999/xlink" xsi:schemaLocation="urn:mpeg:dash:schema:mpd:2011 DASH-MPD.xsd" xmlns:cenc="urn:mpeg:cenc:2013" minBufferTime="PT2S" type="static" profiles="urn:mpeg:dash:profile:isoff-on-demand:2011" mediaPresentationDuration="PT2.7360000610351562S">
|
||||
<MPD xmlns="urn:mpeg:dash:schema:mpd:2011" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xlink="http://www.w3.org/1999/xlink" xsi:schemaLocation="urn:mpeg:dash:schema:mpd:2011 DASH-MPD.xsd" xmlns:cenc="urn:mpeg:cenc:2013" minBufferTime="PT2S" type="static" profiles="urn:mpeg:dash:profile:isoff-on-demand:2011" mediaPresentationDuration="PT2.7809998989105225S">
|
||||
<Period id="0">
|
||||
<AdaptationSet id="0" contentType="video" width="320" height="240" frameRate="1000000/34000" subsegmentAlignment="true" par="16:9">
|
||||
<Representation id="0" bandwidth="210158" codecs="vp09.00.00.08.00.01.00.00" mimeType="video/mp4" sar="427:320">
|
||||
<AdaptationSet id="0" contentType="audio" subsegmentAlignment="true">
|
||||
<Representation id="0" bandwidth="81534" codecs="opus" mimeType="audio/mp4" audioSamplingRate="48000">
|
||||
<AudioChannelConfiguration schemeIdUri="urn:mpeg:dash:23003:3:audio_channel_configuration:2011" value="2"/>
|
||||
<ContentProtection value="cenc" schemeIdUri="urn:mpeg:dash:mp4protection:2011" cenc:default_KID="31323334-3536-3738-3930-313233343536"/>
|
||||
<ContentProtection schemeIdUri="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed">
|
||||
<cenc:pssh>AAAAMHBzc2gAAAAA7e+LqXnWSs6jyCfc1R0h7QAAABAxMjM0NTY3ODkwMTIzNDU2</cenc:pssh>
|
||||
</ContentProtection>
|
||||
<BaseURL>output_audio.mp4</BaseURL>
|
||||
<SegmentBase indexRange="963-1030" timescale="1000000">
|
||||
<Initialization range="0-962"/>
|
||||
</SegmentBase>
|
||||
</Representation>
|
||||
</AdaptationSet>
|
||||
<AdaptationSet id="1" contentType="video" width="320" height="240" frameRate="1000000/34000" subsegmentAlignment="true" par="16:9">
|
||||
<Representation id="1" bandwidth="210158" codecs="vp09.00.00.08.00.01.00.00" mimeType="video/mp4" sar="427:320">
|
||||
<ContentProtection value="cenc" schemeIdUri="urn:mpeg:dash:mp4protection:2011" cenc:default_KID="31323334-3536-3738-3930-313233343536"/>
|
||||
<ContentProtection schemeIdUri="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed">
|
||||
<cenc:pssh>AAAAMHBzc2gAAAAA7e+LqXnWSs6jyCfc1R0h7QAAABAxMjM0NTY3ODkwMTIzNDU2</cenc:pssh>
|
|
@ -99,11 +99,11 @@ std::string AudioStreamInfo::ToString() const {
|
|||
StreamInfo::ToString().c_str(), AudioCodecToString(codec_).c_str(),
|
||||
sample_bits_, num_channels_, sampling_frequency_, language().c_str());
|
||||
if (seek_preroll_ns_ != 0) {
|
||||
base::StringAppendF(&str, " seek_preroll_ns: %" PRIu64 "d\n",
|
||||
base::StringAppendF(&str, " seek_preroll_ns: %" PRIu64 "\n",
|
||||
seek_preroll_ns_);
|
||||
}
|
||||
if (codec_delay_ns_ != 0) {
|
||||
base::StringAppendF(&str, " codec_delay_ns: %" PRIu64 "d\n",
|
||||
base::StringAppendF(&str, " codec_delay_ns: %" PRIu64 "\n",
|
||||
codec_delay_ns_);
|
||||
}
|
||||
return str;
|
||||
|
|
|
@ -61,6 +61,8 @@ VideoCodec FourCCToVideoCodec(FourCC fourcc) {
|
|||
|
||||
AudioCodec FourCCToAudioCodec(FourCC fourcc) {
|
||||
switch(fourcc) {
|
||||
case FOURCC_Opus:
|
||||
return kCodecOpus;
|
||||
case FOURCC_dtsc:
|
||||
return kCodecDTSC;
|
||||
case FOURCC_dtsh:
|
||||
|
|
Loading…
Reference in New Issue