diff --git a/packager/app/test/packager_test.py b/packager/app/test/packager_test.py index 94447b6c97..59f4fb1e99 100755 --- a/packager/app/test/packager_test.py +++ b/packager/app/test/packager_test.py @@ -53,6 +53,10 @@ class PackagerAppTest(unittest.TestCase): else: self.encryption_iv = '3334353637383930' self.widevine_content_id = '3031323334353637' + # TS files may have a non-zero start, which could result in the first + # segment to be less than 1 second. Set clear_lead to be less than 1 + # so only the first segment is left in clear. + self.clear_lead = 0.8 def tearDown(self): if test_env.options.remove_temp_files_after_test: @@ -123,7 +127,6 @@ class PackagerAppTest(unittest.TestCase): strip_parameter_set_nalus=True, encryption=False, fairplay=False, - clear_lead=1, protection_scheme=None, vp9_subsample_encryption=True, decryption=False, @@ -137,6 +140,7 @@ class PackagerAppTest(unittest.TestCase): hls_playlist_type=None, time_shift_buffer_depth=0.0, generate_static_mpd=False, + ad_cues=None, use_fake_clock=True): flags = [] @@ -156,7 +160,7 @@ class PackagerAppTest(unittest.TestCase): '--enable_raw_key_encryption', '--keys=label=:key_id={0}:key={1}'.format(self.encryption_key_id, self.encryption_key), - '--clear_lead={0}'.format(clear_lead) + '--clear_lead={0}'.format(self.clear_lead) ] if not random_iv: @@ -206,6 +210,9 @@ class PackagerAppTest(unittest.TestCase): if generate_static_mpd: flags += ['--generate_static_mpd'] + if ad_cues: + flags += ['--ad_cues', ad_cues] + flags.append('--segment_duration=1') # Use fake clock, so output can be compared. if use_fake_clock: @@ -618,7 +625,7 @@ class PackagerFunctionalTest(PackagerAppTest): self._DiffGold(self.output[0], 'bear-640x360-a-cenc-golden.mp4') self._DiffGold(self.output[1], 'bear-640x360-v-cenc-golden.mp4') self._DiffGold(self.mpd_output, 'bear-640x360-av-cenc-golden.mpd') - self._VerifyDecryption(self.output[0], 'bear-640x360-a-golden.mp4') + self._VerifyDecryption(self.output[0], 'bear-640x360-a-demuxed-golden.mp4') self._VerifyDecryption(self.output[1], 'bear-640x360-v-golden.mp4') # Test deprecated flag --enable_fixed_key_encryption, which is still @@ -627,13 +634,14 @@ class PackagerFunctionalTest(PackagerAppTest): flags = self._GetFlags() + [ '--enable_fixed_key_encryption', '--key_id={0}'.format( self.encryption_key_id), '--key={0}'.format(self.encryption_key), - '--clear_lead={0}'.format(1), '--iv={0}'.format(self.encryption_iv) + '--clear_lead={0}'.format(self.clear_lead), '--iv={0}'.format( + self.encryption_iv) ] self.assertPackageSuccess(self._GetStreams(['audio', 'video']), flags) self._DiffGold(self.output[0], 'bear-640x360-a-cenc-golden.mp4') self._DiffGold(self.output[1], 'bear-640x360-v-cenc-golden.mp4') self._DiffGold(self.mpd_output, 'bear-640x360-av-cenc-golden.mpd') - self._VerifyDecryption(self.output[0], 'bear-640x360-a-golden.mp4') + self._VerifyDecryption(self.output[0], 'bear-640x360-a-demuxed-golden.mp4') self._VerifyDecryption(self.output[1], 'bear-640x360-v-golden.mp4') def testPackageWithEncryptionMultiKeys(self): @@ -644,14 +652,15 @@ class PackagerFunctionalTest(PackagerAppTest): flags = self._GetFlags() + [ '--enable_raw_key_encryption', '--keys=label=AUDIO:key_id={0}:key={1},label=SD:key_id={2}:key={3}'. - format(audio_key_id, audio_key, video_key_id, video_key), - '--clear_lead={0}'.format(1), '--iv={0}'.format(self.encryption_iv) + format(audio_key_id, audio_key, + video_key_id, video_key), '--clear_lead={0}'.format( + self.clear_lead), '--iv={0}'.format(self.encryption_iv) ] self.assertPackageSuccess(self._GetStreams(['audio', 'video']), flags) self.encryption_key_id = audio_key_id self.encryption_key = audio_key - self._VerifyDecryption(self.output[0], 'bear-640x360-a-golden.mp4') + self._VerifyDecryption(self.output[0], 'bear-640x360-a-demuxed-golden.mp4') self.encryption_key_id = video_key_id self.encryption_key = video_key self._VerifyDecryption(self.output[1], 'bear-640x360-v-golden.mp4') @@ -664,8 +673,9 @@ class PackagerFunctionalTest(PackagerAppTest): flags = self._GetFlags() + [ '--enable_raw_key_encryption', '--keys=label=MyAudio:key_id={0}:key={1},label=:key_id={2}:key={3}'. - format(audio_key_id, audio_key, video_key_id, video_key), - '--clear_lead={0}'.format(1), '--iv={0}'.format(self.encryption_iv) + format(audio_key_id, audio_key, + video_key_id, video_key), '--clear_lead={0}'.format( + self.clear_lead), '--iv={0}'.format(self.encryption_iv) ] # DRM label 'MyVideo' is not defined, will fall back to the key for the # empty default label. @@ -675,7 +685,7 @@ class PackagerFunctionalTest(PackagerAppTest): self.encryption_key_id = audio_key_id self.encryption_key = audio_key - self._VerifyDecryption(self.output[0], 'bear-640x360-a-golden.mp4') + self._VerifyDecryption(self.output[0], 'bear-640x360-a-demuxed-golden.mp4') self.encryption_key_id = video_key_id self.encryption_key = video_key self._VerifyDecryption(self.output[1], 'bear-640x360-v-golden.mp4') @@ -697,7 +707,7 @@ class PackagerFunctionalTest(PackagerAppTest): self._DiffGold(self.output[1], 'bear-640x360-v-cenc-golden.mp4') self._DiffGold(self.output[2], 'bear-640x360-v-trick-1-cenc-golden.mp4') self._DiffGold(self.mpd_output, 'bear-640x360-av-trick-1-cenc-golden.mpd') - self._VerifyDecryption(self.output[0], 'bear-640x360-a-golden.mp4') + self._VerifyDecryption(self.output[0], 'bear-640x360-a-demuxed-golden.mp4') self._VerifyDecryption(self.output[1], 'bear-640x360-v-golden.mp4') self._VerifyDecryption(self.output[2], 'bear-640x360-v-trick-1-golden.mp4') @@ -714,22 +724,22 @@ class PackagerFunctionalTest(PackagerAppTest): self._DiffGold(self.output[3], 'bear-640x360-v-trick-2-cenc-golden.mp4') self._DiffGold(self.mpd_output, 'bear-640x360-av-trick-1-trick-2-cenc-golden.mpd') - self._VerifyDecryption(self.output[0], 'bear-640x360-a-golden.mp4') + self._VerifyDecryption(self.output[0], 'bear-640x360-a-demuxed-golden.mp4') self._VerifyDecryption(self.output[1], 'bear-640x360-v-golden.mp4') self._VerifyDecryption(self.output[2], 'bear-640x360-v-trick-1-golden.mp4') self._VerifyDecryption(self.output[3], 'bear-640x360-v-trick-2-golden.mp4') def testPackageWithEncryptionAndNoClearLead(self): + self.clear_lead = 0 self.assertPackageSuccess( - self._GetStreams(['audio', 'video']), - self._GetFlags(encryption=True, clear_lead=0)) + self._GetStreams(['audio', 'video']), self._GetFlags(encryption=True)) self._DiffGold(self.output[0], 'bear-640x360-a-cenc-no-clear-lead-golden.mp4') self._DiffGold(self.output[1], 'bear-640x360-v-cenc-no-clear-lead-golden.mp4') self._DiffGold(self.mpd_output, 'bear-640x360-av-cenc-no-clear-lead-golden.mpd') - self._VerifyDecryption(self.output[0], 'bear-640x360-a-golden.mp4') + self._VerifyDecryption(self.output[0], 'bear-640x360-a-demuxed-golden.mp4') self._VerifyDecryption(self.output[1], 'bear-640x360-v-golden.mp4') def testPackageWithEncryptionAndNoPsshInStream(self): @@ -739,7 +749,7 @@ class PackagerFunctionalTest(PackagerAppTest): self._DiffGold(self.output[0], 'bear-640x360-a-cenc-no-pssh-golden.mp4') self._DiffGold(self.output[1], 'bear-640x360-v-cenc-no-pssh-golden.mp4') self._DiffGold(self.mpd_output, 'bear-640x360-av-cenc-no-pssh-golden.mpd') - self._VerifyDecryption(self.output[0], 'bear-640x360-a-golden.mp4') + self._VerifyDecryption(self.output[0], 'bear-640x360-a-demuxed-golden.mp4') self._VerifyDecryption(self.output[1], 'bear-640x360-v-golden.mp4') def testPackageWithEncryptionCbc1(self): @@ -750,7 +760,7 @@ class PackagerFunctionalTest(PackagerAppTest): self._DiffGold(self.output[0], 'bear-640x360-a-cbc1-golden.mp4') self._DiffGold(self.output[1], 'bear-640x360-v-cbc1-golden.mp4') self._DiffGold(self.mpd_output, 'bear-640x360-av-cbc1-golden.mpd') - self._VerifyDecryption(self.output[0], 'bear-640x360-a-golden.mp4') + self._VerifyDecryption(self.output[0], 'bear-640x360-a-demuxed-golden.mp4') self._VerifyDecryption(self.output[1], 'bear-640x360-v-golden.mp4') def testPackageWithEncryptionCens(self): @@ -761,7 +771,7 @@ class PackagerFunctionalTest(PackagerAppTest): self._DiffGold(self.output[0], 'bear-640x360-a-cens-golden.mp4') self._DiffGold(self.output[1], 'bear-640x360-v-cens-golden.mp4') self._DiffGold(self.mpd_output, 'bear-640x360-av-cens-golden.mpd') - self._VerifyDecryption(self.output[0], 'bear-640x360-a-golden.mp4') + self._VerifyDecryption(self.output[0], 'bear-640x360-a-demuxed-golden.mp4') self._VerifyDecryption(self.output[1], 'bear-640x360-v-golden.mp4') def testPackageWithEncryptionCbcs(self): @@ -772,7 +782,17 @@ class PackagerFunctionalTest(PackagerAppTest): self._DiffGold(self.output[0], 'bear-640x360-a-cbcs-golden.mp4') self._DiffGold(self.output[1], 'bear-640x360-v-cbcs-golden.mp4') self._DiffGold(self.mpd_output, 'bear-640x360-av-cbcs-golden.mpd') - self._VerifyDecryption(self.output[0], 'bear-640x360-a-golden.mp4') + self._VerifyDecryption(self.output[0], 'bear-640x360-a-demuxed-golden.mp4') + self._VerifyDecryption(self.output[1], 'bear-640x360-v-golden.mp4') + + def testPackageWithEncryptionAndAdCues(self): + self.assertPackageSuccess( + self._GetStreams(['audio', 'video']), + self._GetFlags(encryption=True, ad_cues='1.5')) + self._DiffGold(self.output[0], 'bear-640x360-a-cenc-golden.mp4') + self._DiffGold(self.output[1], 'bear-640x360-v-cenc-golden.mp4') + self._DiffGold(self.mpd_output, 'bear-640x360-av-cenc-ad_cues-golden.mpd') + self._VerifyDecryption(self.output[0], 'bear-640x360-a-demuxed-golden.mp4') self._VerifyDecryption(self.output[1], 'bear-640x360-v-golden.mp4') def testPackageWithWebmSubsampleEncryption(self): @@ -980,7 +1000,7 @@ class PackagerFunctionalTest(PackagerAppTest): self.assertFalse(self._CompareWithGold(self.output[1], 'bear-640x360-v-cenc-golden.mp4')) self._DiffGold(self.mpd_output, 'bear-640x360-av-cenc-golden.mpd') - self._VerifyDecryption(self.output[0], 'bear-640x360-a-golden.mp4') + self._VerifyDecryption(self.output[0], 'bear-640x360-a-demuxed-golden.mp4') self._VerifyDecryption(self.output[1], 'bear-640x360-v-golden.mp4') def testPackageWithEncryptionAndRealClock(self): @@ -996,7 +1016,7 @@ class PackagerFunctionalTest(PackagerAppTest): self.assertFalse(self._CompareWithGold(self.output[1], 'bear-640x360-v-cenc-golden.mp4')) self._DiffGold(self.mpd_output, 'bear-640x360-av-cenc-golden.mpd') - self._VerifyDecryption(self.output[0], 'bear-640x360-a-golden.mp4') + self._VerifyDecryption(self.output[0], 'bear-640x360-a-demuxed-golden.mp4') self._VerifyDecryption(self.output[1], 'bear-640x360-v-golden.mp4') def testPackageWithEncryptionAndNonDashIfIop(self): @@ -1031,6 +1051,21 @@ class PackagerFunctionalTest(PackagerAppTest): os.path.join(self.tmp_dir, 'video.m3u8'), 'bear-640x360-v-mp4-cenc-golden.m3u8') + def testPackageWithHlsSingleSegmentMp4EncryptedAndAdCues(self): + self.assertPackageSuccess( + self._GetStreams(['audio', 'video'], hls=True), + self._GetFlags(encryption=True, output_hls=True, ad_cues='1.5')) + self._DiffGold(self.output[0], 'bear-640x360-a-cenc-golden.mp4') + self._DiffGold(self.output[1], 'bear-640x360-v-cenc-golden.mp4') + self._DiffGold(self.hls_master_playlist_output, + 'bear-640x360-av-mp4-master-cenc-golden.m3u8') + self._DiffGold( + os.path.join(self.tmp_dir, 'audio.m3u8'), + 'bear-640x360-a-mp4-cenc-ad_cues-golden.m3u8') + self._DiffGold( + os.path.join(self.tmp_dir, 'video.m3u8'), + 'bear-640x360-v-mp4-cenc-ad_cues-golden.m3u8') + # Test HLS with multi-segment mp4 and content in subdirectories. def testPackageWithHlsMultiSegmentMp4WithCustomPath(self): test_file = os.path.join(self.test_data_dir, 'bear-640x360.mp4') @@ -1074,6 +1109,15 @@ class PackagerFunctionalTest(PackagerAppTest): self._DiffLiveGold(self.output[1], 'bear-640x360-v-live-golden') self._DiffGold(self.mpd_output, 'bear-640x360-av-live-static-golden.mpd') + def testPackageWithLiveStaticProfileAndAdCues(self): + self.assertPackageSuccess( + self._GetStreams(['audio', 'video'], live=True), + self._GetFlags(generate_static_mpd=True, ad_cues='1.5')) + self._DiffLiveGold(self.output[0], 'bear-640x360-a-live-golden') + self._DiffLiveGold(self.output[1], 'bear-640x360-v-live-golden') + self._DiffGold(self.mpd_output, + 'bear-640x360-av-live-static-ad_cues-golden.mpd') + def testPackageWithLiveProfileAndEncryption(self): self.assertPackageSuccess( self._GetStreams(['audio', 'video'], live=True), diff --git a/packager/app/test/testdata/bear-320x240-opus-cenc-golden.mp4 b/packager/app/test/testdata/bear-320x240-opus-cenc-golden.mp4 index 646ae1c329..cdda8b532a 100644 Binary files a/packager/app/test/testdata/bear-320x240-opus-cenc-golden.mp4 and b/packager/app/test/testdata/bear-320x240-opus-cenc-golden.mp4 differ diff --git a/packager/app/test/testdata/bear-320x240-opus-golden.mp4 b/packager/app/test/testdata/bear-320x240-opus-golden.mp4 index 54a091c00c..8af1a3a2bf 100644 Binary files a/packager/app/test/testdata/bear-320x240-opus-golden.mp4 and b/packager/app/test/testdata/bear-320x240-opus-golden.mp4 differ diff --git a/packager/app/test/testdata/bear-320x240-opus-golden.webm b/packager/app/test/testdata/bear-320x240-opus-golden.webm index ed155bc28b..08a035417c 100644 Binary files a/packager/app/test/testdata/bear-320x240-opus-golden.webm and b/packager/app/test/testdata/bear-320x240-opus-golden.webm differ diff --git a/packager/app/test/testdata/bear-320x240-opus-vp9-cenc-golden.mpd b/packager/app/test/testdata/bear-320x240-opus-vp9-cenc-golden.mpd index 7d3209934b..232f14fba6 100644 --- a/packager/app/test/testdata/bear-320x240-opus-vp9-cenc-golden.mpd +++ b/packager/app/test/testdata/bear-320x240-opus-vp9-cenc-golden.mpd @@ -1,13 +1,13 @@ - + AAAANHBzc2gBAAAAEHfv7MCyTQKs4zweUuL7SwAAAAExMjM0NTY3ODkwMTIzNDU2AAAAAA== - + output_audio.mp4 diff --git a/packager/app/test/testdata/bear-320x240-vp9-opus-webm-golden.mpd b/packager/app/test/testdata/bear-320x240-vp9-opus-webm-golden.mpd index e3b2257434..8a22b035a1 100644 --- a/packager/app/test/testdata/bear-320x240-vp9-opus-webm-golden.mpd +++ b/packager/app/test/testdata/bear-320x240-vp9-opus-webm-golden.mpd @@ -1,9 +1,9 @@ - + - + output_audio.webm diff --git a/packager/app/test/testdata/bear-640x360-a-cbc1-golden.mp4 b/packager/app/test/testdata/bear-640x360-a-cbc1-golden.mp4 index afd156b3f3..5760ac2b58 100644 Binary files a/packager/app/test/testdata/bear-640x360-a-cbc1-golden.mp4 and b/packager/app/test/testdata/bear-640x360-a-cbc1-golden.mp4 differ diff --git a/packager/app/test/testdata/bear-640x360-a-cbcs-golden.mp4 b/packager/app/test/testdata/bear-640x360-a-cbcs-golden.mp4 index e185a9f9f8..2c07174911 100644 Binary files a/packager/app/test/testdata/bear-640x360-a-cbcs-golden.mp4 and b/packager/app/test/testdata/bear-640x360-a-cbcs-golden.mp4 differ diff --git a/packager/app/test/testdata/bear-640x360-a-cenc-golden.mp4 b/packager/app/test/testdata/bear-640x360-a-cenc-golden.mp4 index 46e073eefe..2b40464893 100644 Binary files a/packager/app/test/testdata/bear-640x360-a-cenc-golden.mp4 and b/packager/app/test/testdata/bear-640x360-a-cenc-golden.mp4 differ diff --git a/packager/app/test/testdata/bear-640x360-a-cenc-golden.mp4.media_info b/packager/app/test/testdata/bear-640x360-a-cenc-golden.mp4.media_info index 3244f9075d..7f119685c9 100644 --- a/packager/app/test/testdata/bear-640x360-a-cenc-golden.mp4.media_info +++ b/packager/app/test/testdata/bear-640x360-a-cenc-golden.mp4.media_info @@ -1,4 +1,4 @@ -bandwidth: 129162 +bandwidth: 129185 audio_info { codec: "mp4a.40.2" sampling_frequency: 44100 diff --git a/packager/app/test/testdata/bear-640x360-a-cenc-no-clear-lead-golden.mp4 b/packager/app/test/testdata/bear-640x360-a-cenc-no-clear-lead-golden.mp4 index fd6baf5aa9..08c44d8285 100644 Binary files a/packager/app/test/testdata/bear-640x360-a-cenc-no-clear-lead-golden.mp4 and b/packager/app/test/testdata/bear-640x360-a-cenc-no-clear-lead-golden.mp4 differ diff --git a/packager/app/test/testdata/bear-640x360-a-cenc-no-pssh-golden.mp4 b/packager/app/test/testdata/bear-640x360-a-cenc-no-pssh-golden.mp4 index 8da4e3efaf..318a7f278a 100644 Binary files a/packager/app/test/testdata/bear-640x360-a-cenc-no-pssh-golden.mp4 and b/packager/app/test/testdata/bear-640x360-a-cenc-no-pssh-golden.mp4 differ diff --git a/packager/app/test/testdata/bear-640x360-a-cens-golden.mp4 b/packager/app/test/testdata/bear-640x360-a-cens-golden.mp4 index 87236142e2..067799fab6 100644 Binary files a/packager/app/test/testdata/bear-640x360-a-cens-golden.mp4 and b/packager/app/test/testdata/bear-640x360-a-cens-golden.mp4 differ diff --git a/packager/app/test/testdata/bear-640x360-a-demuxed-golden.mp4 b/packager/app/test/testdata/bear-640x360-a-demuxed-golden.mp4 new file mode 100644 index 0000000000..d58886f965 Binary files /dev/null and b/packager/app/test/testdata/bear-640x360-a-demuxed-golden.mp4 differ diff --git a/packager/app/test/testdata/bear-640x360-a-enc-golden-1.ts b/packager/app/test/testdata/bear-640x360-a-enc-golden-1.ts index c492a868c3..17d20c42c9 100644 Binary files a/packager/app/test/testdata/bear-640x360-a-enc-golden-1.ts and b/packager/app/test/testdata/bear-640x360-a-enc-golden-1.ts differ diff --git a/packager/app/test/testdata/bear-640x360-a-enc-golden-2.ts b/packager/app/test/testdata/bear-640x360-a-enc-golden-2.ts index 5f386328e3..3c3e210dac 100644 Binary files a/packager/app/test/testdata/bear-640x360-a-enc-golden-2.ts and b/packager/app/test/testdata/bear-640x360-a-enc-golden-2.ts differ diff --git a/packager/app/test/testdata/bear-640x360-a-enc-golden-3.ts b/packager/app/test/testdata/bear-640x360-a-enc-golden-3.ts index fafb892ed8..ac61fde335 100644 Binary files a/packager/app/test/testdata/bear-640x360-a-enc-golden-3.ts and b/packager/app/test/testdata/bear-640x360-a-enc-golden-3.ts differ diff --git a/packager/app/test/testdata/bear-640x360-a-enc-golden.m3u8 b/packager/app/test/testdata/bear-640x360-a-enc-golden.m3u8 index c88c902b51..9c67fa201d 100644 --- a/packager/app/test/testdata/bear-640x360-a-enc-golden.m3u8 +++ b/packager/app/test/testdata/bear-640x360-a-enc-golden.m3u8 @@ -3,12 +3,12 @@ ## Generated with https://github.com/google/shaka-packager version -- #EXT-X-TARGETDURATION:2 #EXT-X-PLAYLIST-TYPE:VOD -#EXTINF:0.975, +#EXTINF:0.952, output_audio-1.ts -#EXTINF:0.998, -output_audio-2.ts #EXT-X-DISCONTINUITY #EXT-X-KEY:METHOD=SAMPLE-AES,URI="data:text/plain;base64,MTIzNDU2Nzg5MDEyMzQ1Ng==",IV=0x3334353637383930,KEYFORMAT="identity" -#EXTINF:0.789, +#EXTINF:0.998, +output_audio-2.ts +#EXTINF:0.813, output_audio-3.ts #EXT-X-ENDLIST diff --git a/packager/app/test/testdata/bear-640x360-a-enc-rotation-golden-1.ts b/packager/app/test/testdata/bear-640x360-a-enc-rotation-golden-1.ts index c492a868c3..17d20c42c9 100644 Binary files a/packager/app/test/testdata/bear-640x360-a-enc-rotation-golden-1.ts and b/packager/app/test/testdata/bear-640x360-a-enc-rotation-golden-1.ts differ diff --git a/packager/app/test/testdata/bear-640x360-a-enc-rotation-golden-2.ts b/packager/app/test/testdata/bear-640x360-a-enc-rotation-golden-2.ts index 5f386328e3..3c3e210dac 100644 Binary files a/packager/app/test/testdata/bear-640x360-a-enc-rotation-golden-2.ts and b/packager/app/test/testdata/bear-640x360-a-enc-rotation-golden-2.ts differ diff --git a/packager/app/test/testdata/bear-640x360-a-enc-rotation-golden-3.ts b/packager/app/test/testdata/bear-640x360-a-enc-rotation-golden-3.ts index 3f18799587..1b21a7eb22 100644 Binary files a/packager/app/test/testdata/bear-640x360-a-enc-rotation-golden-3.ts and b/packager/app/test/testdata/bear-640x360-a-enc-rotation-golden-3.ts differ diff --git a/packager/app/test/testdata/bear-640x360-a-event-golden.m3u8 b/packager/app/test/testdata/bear-640x360-a-event-golden.m3u8 index cb2d47ca5d..ae07db12d1 100644 --- a/packager/app/test/testdata/bear-640x360-a-event-golden.m3u8 +++ b/packager/app/test/testdata/bear-640x360-a-event-golden.m3u8 @@ -3,9 +3,9 @@ ## Generated with https://github.com/google/shaka-packager version -- #EXT-X-TARGETDURATION:2 #EXT-X-PLAYLIST-TYPE:EVENT -#EXTINF:0.975, +#EXTINF:0.952, output_audio-1.ts #EXTINF:0.998, output_audio-2.ts -#EXTINF:0.789, +#EXTINF:0.813, output_audio-3.ts diff --git a/packager/app/test/testdata/bear-640x360-a-fairplay-enc-golden.m3u8 b/packager/app/test/testdata/bear-640x360-a-fairplay-enc-golden.m3u8 index 16f7f5091f..166a8f4174 100644 --- a/packager/app/test/testdata/bear-640x360-a-fairplay-enc-golden.m3u8 +++ b/packager/app/test/testdata/bear-640x360-a-fairplay-enc-golden.m3u8 @@ -3,12 +3,12 @@ ## Generated with https://github.com/google/shaka-packager version -- #EXT-X-TARGETDURATION:2 #EXT-X-PLAYLIST-TYPE:VOD -#EXTINF:0.975, +#EXTINF:0.952, output_audio-1.ts -#EXTINF:0.998, -output_audio-2.ts #EXT-X-DISCONTINUITY #EXT-X-KEY:METHOD=SAMPLE-AES,URI="skd://www.license.com/getkey?KeyId=31323334-3536-3738-3930-313233343536",KEYFORMATVERSIONS="1",KEYFORMAT="com.apple.streamingkeydelivery" -#EXTINF:0.789, +#EXTINF:0.998, +output_audio-2.ts +#EXTINF:0.813, output_audio-3.ts #EXT-X-ENDLIST diff --git a/packager/app/test/testdata/bear-640x360-a-golden-1.ts b/packager/app/test/testdata/bear-640x360-a-golden-1.ts index c492a868c3..17d20c42c9 100644 Binary files a/packager/app/test/testdata/bear-640x360-a-golden-1.ts and b/packager/app/test/testdata/bear-640x360-a-golden-1.ts differ diff --git a/packager/app/test/testdata/bear-640x360-a-golden-2.ts b/packager/app/test/testdata/bear-640x360-a-golden-2.ts index 5f386328e3..977aa81f5a 100644 Binary files a/packager/app/test/testdata/bear-640x360-a-golden-2.ts and b/packager/app/test/testdata/bear-640x360-a-golden-2.ts differ diff --git a/packager/app/test/testdata/bear-640x360-a-golden-3.ts b/packager/app/test/testdata/bear-640x360-a-golden-3.ts index fcfe141d34..926ef4c075 100644 Binary files a/packager/app/test/testdata/bear-640x360-a-golden-3.ts and b/packager/app/test/testdata/bear-640x360-a-golden-3.ts differ diff --git a/packager/app/test/testdata/bear-640x360-a-golden.m3u8 b/packager/app/test/testdata/bear-640x360-a-golden.m3u8 index 0209c9b3f2..d46157a0c8 100644 --- a/packager/app/test/testdata/bear-640x360-a-golden.m3u8 +++ b/packager/app/test/testdata/bear-640x360-a-golden.m3u8 @@ -3,10 +3,10 @@ ## Generated with https://github.com/google/shaka-packager version -- #EXT-X-TARGETDURATION:2 #EXT-X-PLAYLIST-TYPE:VOD -#EXTINF:0.975, +#EXTINF:0.952, output_audio-1.ts #EXTINF:0.998, output_audio-2.ts -#EXTINF:0.789, +#EXTINF:0.813, output_audio-3.ts #EXT-X-ENDLIST diff --git a/packager/app/test/testdata/bear-640x360-a-golden.mp4 b/packager/app/test/testdata/bear-640x360-a-golden.mp4 index d58886f965..363c933a1a 100644 Binary files a/packager/app/test/testdata/bear-640x360-a-golden.mp4 and b/packager/app/test/testdata/bear-640x360-a-golden.mp4 differ diff --git a/packager/app/test/testdata/bear-640x360-a-live-cenc-golden-1.m4s b/packager/app/test/testdata/bear-640x360-a-live-cenc-golden-1.m4s index f336d41dd2..26e069ee9e 100644 Binary files a/packager/app/test/testdata/bear-640x360-a-live-cenc-golden-1.m4s and b/packager/app/test/testdata/bear-640x360-a-live-cenc-golden-1.m4s differ diff --git a/packager/app/test/testdata/bear-640x360-a-live-cenc-golden-2.m4s b/packager/app/test/testdata/bear-640x360-a-live-cenc-golden-2.m4s index e285304cbf..e7e2c85278 100644 Binary files a/packager/app/test/testdata/bear-640x360-a-live-cenc-golden-2.m4s and b/packager/app/test/testdata/bear-640x360-a-live-cenc-golden-2.m4s differ diff --git a/packager/app/test/testdata/bear-640x360-a-live-cenc-golden-3.m4s b/packager/app/test/testdata/bear-640x360-a-live-cenc-golden-3.m4s index f197652913..4243aa6447 100644 Binary files a/packager/app/test/testdata/bear-640x360-a-live-cenc-golden-3.m4s and b/packager/app/test/testdata/bear-640x360-a-live-cenc-golden-3.m4s differ diff --git a/packager/app/test/testdata/bear-640x360-a-live-cenc-rotation-golden-1.m4s b/packager/app/test/testdata/bear-640x360-a-live-cenc-rotation-golden-1.m4s index 50e3c1afc8..bf8580ceb3 100644 Binary files a/packager/app/test/testdata/bear-640x360-a-live-cenc-rotation-golden-1.m4s and b/packager/app/test/testdata/bear-640x360-a-live-cenc-rotation-golden-1.m4s differ diff --git a/packager/app/test/testdata/bear-640x360-a-live-cenc-rotation-golden-2.m4s b/packager/app/test/testdata/bear-640x360-a-live-cenc-rotation-golden-2.m4s index b48c322560..846a7fb92e 100644 Binary files a/packager/app/test/testdata/bear-640x360-a-live-cenc-rotation-golden-2.m4s and b/packager/app/test/testdata/bear-640x360-a-live-cenc-rotation-golden-2.m4s differ diff --git a/packager/app/test/testdata/bear-640x360-a-live-cenc-rotation-golden-3.m4s b/packager/app/test/testdata/bear-640x360-a-live-cenc-rotation-golden-3.m4s index dd5d4b9f09..3354221854 100644 Binary files a/packager/app/test/testdata/bear-640x360-a-live-cenc-rotation-golden-3.m4s and b/packager/app/test/testdata/bear-640x360-a-live-cenc-rotation-golden-3.m4s differ diff --git a/packager/app/test/testdata/bear-640x360-a-live-cenc-rotation-no-pssh-golden-1.m4s b/packager/app/test/testdata/bear-640x360-a-live-cenc-rotation-no-pssh-golden-1.m4s index f336d41dd2..26e069ee9e 100644 Binary files a/packager/app/test/testdata/bear-640x360-a-live-cenc-rotation-no-pssh-golden-1.m4s and b/packager/app/test/testdata/bear-640x360-a-live-cenc-rotation-no-pssh-golden-1.m4s differ diff --git a/packager/app/test/testdata/bear-640x360-a-live-cenc-rotation-no-pssh-golden-2.m4s b/packager/app/test/testdata/bear-640x360-a-live-cenc-rotation-no-pssh-golden-2.m4s index 39468e7e43..087c95234d 100644 Binary files a/packager/app/test/testdata/bear-640x360-a-live-cenc-rotation-no-pssh-golden-2.m4s and b/packager/app/test/testdata/bear-640x360-a-live-cenc-rotation-no-pssh-golden-2.m4s differ diff --git a/packager/app/test/testdata/bear-640x360-a-live-cenc-rotation-no-pssh-golden-3.m4s b/packager/app/test/testdata/bear-640x360-a-live-cenc-rotation-no-pssh-golden-3.m4s index e179f1c7e3..a15ea991f8 100644 Binary files a/packager/app/test/testdata/bear-640x360-a-live-cenc-rotation-no-pssh-golden-3.m4s and b/packager/app/test/testdata/bear-640x360-a-live-cenc-rotation-no-pssh-golden-3.m4s differ diff --git a/packager/app/test/testdata/bear-640x360-a-live-enc-rotation-golden.m3u8 b/packager/app/test/testdata/bear-640x360-a-live-enc-rotation-golden.m3u8 index 40c3f77628..916ab207fc 100644 --- a/packager/app/test/testdata/bear-640x360-a-live-enc-rotation-golden.m3u8 +++ b/packager/app/test/testdata/bear-640x360-a-live-enc-rotation-golden.m3u8 @@ -3,9 +3,10 @@ ## Generated with https://github.com/google/shaka-packager version -- #EXT-X-TARGETDURATION:2 #EXT-X-MEDIA-SEQUENCE:1 +#EXT-X-DISCONTINUITY-SEQUENCE:1 +#EXT-X-KEY:METHOD=SAMPLE-AES,URI="data:text/plain;base64,MTIzNDU2Nzg5MDEyMzQ1Ng==",IV=0x3334353637383930,KEYFORMAT="identity" #EXTINF:0.998, output_audio-2.ts -#EXT-X-DISCONTINUITY -#EXT-X-KEY:METHOD=SAMPLE-AES,URI="data:text/plain;base64,MzQ1Njc4OTAxMjM0NTYxMg==",IV=0x3334353637383930,KEYFORMAT="identity" -#EXTINF:0.789, +#EXT-X-KEY:METHOD=SAMPLE-AES,URI="data:text/plain;base64,MjM0NTY3ODkwMTIzNDU2MQ==",IV=0x3334353637383930,KEYFORMAT="identity" +#EXTINF:0.813, output_audio-3.ts diff --git a/packager/app/test/testdata/bear-640x360-a-live-golden-1.m4s b/packager/app/test/testdata/bear-640x360-a-live-golden-1.m4s index c4b4ac03d9..f37ed8a13c 100644 Binary files a/packager/app/test/testdata/bear-640x360-a-live-golden-1.m4s and b/packager/app/test/testdata/bear-640x360-a-live-golden-1.m4s differ diff --git a/packager/app/test/testdata/bear-640x360-a-live-golden-2.m4s b/packager/app/test/testdata/bear-640x360-a-live-golden-2.m4s index 8504387c99..bf0257dff3 100644 Binary files a/packager/app/test/testdata/bear-640x360-a-live-golden-2.m4s and b/packager/app/test/testdata/bear-640x360-a-live-golden-2.m4s differ diff --git a/packager/app/test/testdata/bear-640x360-a-live-golden-3.m4s b/packager/app/test/testdata/bear-640x360-a-live-golden-3.m4s index 99af31e503..4efd91c5dd 100644 Binary files a/packager/app/test/testdata/bear-640x360-a-live-golden-3.m4s and b/packager/app/test/testdata/bear-640x360-a-live-golden-3.m4s differ diff --git a/packager/app/test/testdata/bear-640x360-a-live-golden.m3u8 b/packager/app/test/testdata/bear-640x360-a-live-golden.m3u8 index c2993e32b6..086a1dad8a 100644 --- a/packager/app/test/testdata/bear-640x360-a-live-golden.m3u8 +++ b/packager/app/test/testdata/bear-640x360-a-live-golden.m3u8 @@ -5,5 +5,5 @@ #EXT-X-MEDIA-SEQUENCE:1 #EXTINF:0.998, output_audio-2.ts -#EXTINF:0.789, +#EXTINF:0.813, output_audio-3.ts diff --git a/packager/app/test/testdata/bear-640x360-a-mp4-cenc-ad_cues-golden.m3u8 b/packager/app/test/testdata/bear-640x360-a-mp4-cenc-ad_cues-golden.m3u8 new file mode 100644 index 0000000000..12f3f33190 --- /dev/null +++ b/packager/app/test/testdata/bear-640x360-a-mp4-cenc-ad_cues-golden.m3u8 @@ -0,0 +1,18 @@ +#EXTM3U +#EXT-X-VERSION:6 +## Generated with https://github.com/google/shaka-packager version -- +#EXT-X-TARGETDURATION:2 +#EXT-X-PLAYLIST-TYPE:VOD +#EXT-X-MAP:URI="output_audio.mp4",BYTERANGE="967@0" +#EXT-X-KEY:METHOD=SAMPLE-AES-CENC,URI="data:text/plain;base64,MTIzNDU2Nzg5MDEyMzQ1Ng==",KEYFORMAT="identity" +#EXTINF:0.998, +#EXT-X-BYTERANGE:16279@1035 +output_audio.mp4 +#EXTINF:0.998, +#EXT-X-BYTERANGE:16674 +output_audio.mp4 +#EXT-X-PLACEMENT-OPPORTUNITY +#EXTINF:0.766, +#EXT-X-BYTERANGE:10632 +output_audio.mp4 +#EXT-X-ENDLIST diff --git a/packager/app/test/testdata/bear-640x360-a-mp4-cenc-golden.m3u8 b/packager/app/test/testdata/bear-640x360-a-mp4-cenc-golden.m3u8 index 2d839ae79d..ec19ad620b 100644 --- a/packager/app/test/testdata/bear-640x360-a-mp4-cenc-golden.m3u8 +++ b/packager/app/test/testdata/bear-640x360-a-mp4-cenc-golden.m3u8 @@ -5,13 +5,13 @@ #EXT-X-PLAYLIST-TYPE:VOD #EXT-X-MAP:URI="output_audio.mp4",BYTERANGE="967@0" #EXT-X-KEY:METHOD=SAMPLE-AES-CENC,URI="data:text/plain;base64,MTIzNDU2Nzg5MDEyMzQ1Ng==",KEYFORMAT="identity" -#EXTINF:1.022, -#EXT-X-BYTERANGE:16655@1035 +#EXTINF:0.998, +#EXT-X-BYTERANGE:16279@1035 output_audio.mp4 #EXTINF:0.998, -#EXT-X-BYTERANGE:16650 +#EXT-X-BYTERANGE:16674 output_audio.mp4 -#EXTINF:0.743, -#EXT-X-BYTERANGE:10272 +#EXTINF:0.766, +#EXT-X-BYTERANGE:10632 output_audio.mp4 #EXT-X-ENDLIST diff --git a/packager/app/test/testdata/bear-640x360-a-mp4-golden.m3u8 b/packager/app/test/testdata/bear-640x360-a-mp4-golden.m3u8 index c9719d6f6f..d011a2c514 100644 --- a/packager/app/test/testdata/bear-640x360-a-mp4-golden.m3u8 +++ b/packager/app/test/testdata/bear-640x360-a-mp4-golden.m3u8 @@ -4,10 +4,10 @@ #EXT-X-TARGETDURATION:2 #EXT-X-PLAYLIST-TYPE:VOD #EXT-X-MAP:URI="audio-init.mp4" -#EXTINF:1.022, +#EXTINF:0.998, audio-1.m4s #EXTINF:0.998, audio-2.m4s -#EXTINF:0.743, +#EXTINF:0.766, audio-3.m4s #EXT-X-ENDLIST diff --git a/packager/app/test/testdata/bear-640x360-a-por-BR-golden.mp4 b/packager/app/test/testdata/bear-640x360-a-por-BR-golden.mp4 index a68f12768a..090a83e729 100644 Binary files a/packager/app/test/testdata/bear-640x360-a-por-BR-golden.mp4 and b/packager/app/test/testdata/bear-640x360-a-por-BR-golden.mp4 differ diff --git a/packager/app/test/testdata/bear-640x360-a-por-golden.mp4 b/packager/app/test/testdata/bear-640x360-a-por-golden.mp4 index a68f12768a..090a83e729 100644 Binary files a/packager/app/test/testdata/bear-640x360-a-por-golden.mp4 and b/packager/app/test/testdata/bear-640x360-a-por-golden.mp4 differ diff --git a/packager/app/test/testdata/bear-640x360-a-sync-golden.mp4 b/packager/app/test/testdata/bear-640x360-a-sync-golden.mp4 new file mode 100644 index 0000000000..363c933a1a Binary files /dev/null and b/packager/app/test/testdata/bear-640x360-a-sync-golden.mp4 differ diff --git a/packager/app/test/testdata/bear-640x360-ac3-enc-golden-2.ts b/packager/app/test/testdata/bear-640x360-ac3-enc-golden-2.ts index b5803febbf..f76f3c8362 100644 Binary files a/packager/app/test/testdata/bear-640x360-ac3-enc-golden-2.ts and b/packager/app/test/testdata/bear-640x360-ac3-enc-golden-2.ts differ diff --git a/packager/app/test/testdata/bear-640x360-ac3-enc-golden-3.ts b/packager/app/test/testdata/bear-640x360-ac3-enc-golden-3.ts index 39a1002c18..0b71ff9387 100644 Binary files a/packager/app/test/testdata/bear-640x360-ac3-enc-golden-3.ts and b/packager/app/test/testdata/bear-640x360-ac3-enc-golden-3.ts differ diff --git a/packager/app/test/testdata/bear-640x360-ac3-enc-golden.m3u8 b/packager/app/test/testdata/bear-640x360-ac3-enc-golden.m3u8 index b0c2e0ba26..95f63083b0 100644 --- a/packager/app/test/testdata/bear-640x360-ac3-enc-golden.m3u8 +++ b/packager/app/test/testdata/bear-640x360-ac3-enc-golden.m3u8 @@ -5,10 +5,10 @@ #EXT-X-PLAYLIST-TYPE:VOD #EXTINF:0.975, output_audio-1.ts -#EXTINF:1.010, -output_audio-2.ts #EXT-X-DISCONTINUITY #EXT-X-KEY:METHOD=SAMPLE-AES,URI="data:text/plain;base64,MTIzNDU2Nzg5MDEyMzQ1Ng==",IV=0x3334353637383930,KEYFORMAT="identity" -#EXTINF:0.801, +#EXTINF:0.975, +output_audio-2.ts +#EXTINF:0.836, output_audio-3.ts #EXT-X-ENDLIST diff --git a/packager/app/test/testdata/bear-640x360-ac3-from-ts-golden.mp4 b/packager/app/test/testdata/bear-640x360-ac3-from-ts-golden.mp4 index 3c4ec7a4b0..48a4618685 100644 Binary files a/packager/app/test/testdata/bear-640x360-ac3-from-ts-golden.mp4 and b/packager/app/test/testdata/bear-640x360-ac3-from-ts-golden.mp4 differ diff --git a/packager/app/test/testdata/bear-640x360-ac3-golden-2.ts b/packager/app/test/testdata/bear-640x360-ac3-golden-2.ts index b5803febbf..1ef30535e1 100644 Binary files a/packager/app/test/testdata/bear-640x360-ac3-golden-2.ts and b/packager/app/test/testdata/bear-640x360-ac3-golden-2.ts differ diff --git a/packager/app/test/testdata/bear-640x360-ac3-golden-3.ts b/packager/app/test/testdata/bear-640x360-ac3-golden-3.ts index a8de767844..7808415253 100644 Binary files a/packager/app/test/testdata/bear-640x360-ac3-golden-3.ts and b/packager/app/test/testdata/bear-640x360-ac3-golden-3.ts differ diff --git a/packager/app/test/testdata/bear-640x360-ac3-golden.m3u8 b/packager/app/test/testdata/bear-640x360-ac3-golden.m3u8 index 0a45f41b03..f236f95de1 100644 --- a/packager/app/test/testdata/bear-640x360-ac3-golden.m3u8 +++ b/packager/app/test/testdata/bear-640x360-ac3-golden.m3u8 @@ -5,8 +5,8 @@ #EXT-X-PLAYLIST-TYPE:VOD #EXTINF:0.975, output_audio-1.ts -#EXTINF:1.010, +#EXTINF:0.975, output_audio-2.ts -#EXTINF:0.801, +#EXTINF:0.836, output_audio-3.ts #EXT-X-ENDLIST diff --git a/packager/app/test/testdata/bear-640x360-ac3-ts-to-mp4-golden.m3u8 b/packager/app/test/testdata/bear-640x360-ac3-ts-to-mp4-golden.m3u8 index 98e8e1b9b7..b8a4080daa 100644 --- a/packager/app/test/testdata/bear-640x360-ac3-ts-to-mp4-golden.m3u8 +++ b/packager/app/test/testdata/bear-640x360-ac3-ts-to-mp4-golden.m3u8 @@ -7,10 +7,10 @@ #EXTINF:0.975, #EXT-X-BYTERANGE:23728@794 output_audio.mp4 -#EXTINF:1.010, -#EXT-X-BYTERANGE:24574 +#EXTINF:0.975, +#EXT-X-BYTERANGE:23730 output_audio.mp4 -#EXTINF:0.801, -#EXT-X-BYTERANGE:19510 +#EXTINF:0.836, +#EXT-X-BYTERANGE:20354 output_audio.mp4 #EXT-X-ENDLIST diff --git a/packager/app/test/testdata/bear-640x360-av-ac3-master-golden.m3u8 b/packager/app/test/testdata/bear-640x360-av-ac3-master-golden.m3u8 index 7e6532aec3..055c6b17fc 100644 --- a/packager/app/test/testdata/bear-640x360-av-ac3-master-golden.m3u8 +++ b/packager/app/test/testdata/bear-640x360-av-ac3-master-golden.m3u8 @@ -1,5 +1,5 @@ #EXTM3U ## Generated with https://github.com/google/shaka-packager version -- #EXT-X-MEDIA:TYPE=AUDIO,URI="audio.m3u8",GROUP-ID="audio",NAME="stream_0",AUTOSELECT=YES,CHANNELS="2" -#EXT-X-STREAM-INF:BANDWIDTH=1242861,CODECS="avc1.64001e,ac-3",RESOLUTION=640x360,AUDIO="audio" +#EXT-X-STREAM-INF:BANDWIDTH=1242703,CODECS="avc1.64001e,ac-3",RESOLUTION=640x360,AUDIO="audio" video.m3u8 diff --git a/packager/app/test/testdata/bear-640x360-av-ac3-ts-to-mp4-master-golden.m3u8 b/packager/app/test/testdata/bear-640x360-av-ac3-ts-to-mp4-master-golden.m3u8 index 046a9b1e5e..f26320f415 100644 --- a/packager/app/test/testdata/bear-640x360-av-ac3-ts-to-mp4-master-golden.m3u8 +++ b/packager/app/test/testdata/bear-640x360-av-ac3-ts-to-mp4-master-golden.m3u8 @@ -1,5 +1,5 @@ #EXTM3U ## Generated with https://github.com/google/shaka-packager version -- #EXT-X-MEDIA:TYPE=AUDIO,URI="audio.m3u8",GROUP-ID="audio",NAME="stream_0",AUTOSELECT=YES,CHANNELS="2" -#EXT-X-STREAM-INF:BANDWIDTH=1168319,CODECS="avc1.64001e,ac-3",RESOLUTION=640x360,AUDIO="audio" +#EXT-X-STREAM-INF:BANDWIDTH=1168277,CODECS="avc1.64001e,ac-3",RESOLUTION=640x360,AUDIO="audio" video.m3u8 diff --git a/packager/app/test/testdata/bear-640x360-av-cbc1-golden.mpd b/packager/app/test/testdata/bear-640x360-av-cbc1-golden.mpd index e79e6ef92f..72c50df379 100644 --- a/packager/app/test/testdata/bear-640x360-av-cbc1-golden.mpd +++ b/packager/app/test/testdata/bear-640x360-av-cbc1-golden.mpd @@ -19,7 +19,7 @@ AAAANHBzc2gBAAAAEHfv7MCyTQKs4zweUuL7SwAAAAExMjM0NTY3ODkwMTIzNDU2AAAAAA== - + output_audio.mp4 diff --git a/packager/app/test/testdata/bear-640x360-av-cenc-ad_cues-golden.mpd b/packager/app/test/testdata/bear-640x360-av-cenc-ad_cues-golden.mpd new file mode 100644 index 0000000000..a621a88abf --- /dev/null +++ b/packager/app/test/testdata/bear-640x360-av-cenc-ad_cues-golden.mpd @@ -0,0 +1,58 @@ + + + + + + + + AAAANHBzc2gBAAAAEHfv7MCyTQKs4zweUuL7SwAAAAExMjM0NTY3ODkwMTIzNDU2AAAAAA== + + + output_video.mp4 + + + + + + + + + AAAANHBzc2gBAAAAEHfv7MCyTQKs4zweUuL7SwAAAAExMjM0NTY3ODkwMTIzNDU2AAAAAA== + + + + output_audio.mp4 + + + + + + + + + + + AAAANHBzc2gBAAAAEHfv7MCyTQKs4zweUuL7SwAAAAExMjM0NTY3ODkwMTIzNDU2AAAAAA== + + + output_video.mp4 + + + + + + + + + AAAANHBzc2gBAAAAEHfv7MCyTQKs4zweUuL7SwAAAAExMjM0NTY3ODkwMTIzNDU2AAAAAA== + + + + output_audio.mp4 + + + + + + + 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 e87441b29e..8b257daeb9 100644 --- a/packager/app/test/testdata/bear-640x360-av-cenc-golden.mpd +++ b/packager/app/test/testdata/bear-640x360-av-cenc-golden.mpd @@ -19,7 +19,7 @@ AAAANHBzc2gBAAAAEHfv7MCyTQKs4zweUuL7SwAAAAExMjM0NTY3ODkwMTIzNDU2AAAAAA== - + output_audio.mp4 diff --git a/packager/app/test/testdata/bear-640x360-av-cenc-no-pssh-golden.mpd b/packager/app/test/testdata/bear-640x360-av-cenc-no-pssh-golden.mpd index 950b78976f..b7400f71bb 100644 --- a/packager/app/test/testdata/bear-640x360-av-cenc-no-pssh-golden.mpd +++ b/packager/app/test/testdata/bear-640x360-av-cenc-no-pssh-golden.mpd @@ -19,7 +19,7 @@ AAAANHBzc2gBAAAAEHfv7MCyTQKs4zweUuL7SwAAAAExMjM0NTY3ODkwMTIzNDU2AAAAAA== - + output_audio.mp4 diff --git a/packager/app/test/testdata/bear-640x360-av-cenc-non-iop-golden.mpd b/packager/app/test/testdata/bear-640x360-av-cenc-non-iop-golden.mpd index 8e38072ee0..be5e4496c6 100644 --- a/packager/app/test/testdata/bear-640x360-av-cenc-non-iop-golden.mpd +++ b/packager/app/test/testdata/bear-640x360-av-cenc-non-iop-golden.mpd @@ -15,7 +15,7 @@ - + diff --git a/packager/app/test/testdata/bear-640x360-av-cens-golden.mpd b/packager/app/test/testdata/bear-640x360-av-cens-golden.mpd index edc1461ce1..98ff74f0e1 100644 --- a/packager/app/test/testdata/bear-640x360-av-cens-golden.mpd +++ b/packager/app/test/testdata/bear-640x360-av-cens-golden.mpd @@ -19,7 +19,7 @@ AAAANHBzc2gBAAAAEHfv7MCyTQKs4zweUuL7SwAAAAExMjM0NTY3ODkwMTIzNDU2AAAAAA== - + 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 b904b4dde3..7c994c222e 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 @@ -21,13 +21,12 @@ AAAANHBzc2gBAAAAEHfv7MCyTQKs4zweUuL7SwAAAAExMjM0NTY3ODkwMTIzNDU2AAAAAA== - + - - - + + diff --git a/packager/app/test/testdata/bear-640x360-av-live-cenc-non-iop-golden.mpd b/packager/app/test/testdata/bear-640x360-av-live-cenc-non-iop-golden.mpd index 7358bb9452..2ff1091ee3 100644 --- a/packager/app/test/testdata/bear-640x360-av-live-cenc-non-iop-golden.mpd +++ b/packager/app/test/testdata/bear-640x360-av-live-cenc-non-iop-golden.mpd @@ -17,7 +17,7 @@ - + @@ -25,9 +25,8 @@ - - - + + 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 e9c4348da4..47ca735044 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 @@ -17,13 +17,12 @@ - + - - - + + diff --git a/packager/app/test/testdata/bear-640x360-av-live-cenc-rotation-no-pssh-golden.mpd b/packager/app/test/testdata/bear-640x360-av-live-cenc-rotation-no-pssh-golden.mpd index 9265f2e191..779863417c 100644 --- a/packager/app/test/testdata/bear-640x360-av-live-cenc-rotation-no-pssh-golden.mpd +++ b/packager/app/test/testdata/bear-640x360-av-live-cenc-rotation-no-pssh-golden.mpd @@ -17,13 +17,12 @@ - + - - - + + diff --git a/packager/app/test/testdata/bear-640x360-av-live-cenc-rotation-non-iop-golden.mpd b/packager/app/test/testdata/bear-640x360-av-live-cenc-rotation-non-iop-golden.mpd index 81eb4d90d5..90fa72cdd1 100644 --- a/packager/app/test/testdata/bear-640x360-av-live-cenc-rotation-non-iop-golden.mpd +++ b/packager/app/test/testdata/bear-640x360-av-live-cenc-rotation-non-iop-golden.mpd @@ -15,15 +15,14 @@ - + - - - + + 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 4faf8e66e8..3bba3a7577 100644 --- a/packager/app/test/testdata/bear-640x360-av-live-golden.mpd +++ b/packager/app/test/testdata/bear-640x360-av-live-golden.mpd @@ -13,13 +13,12 @@ - + - - - + + diff --git a/packager/app/test/testdata/bear-640x360-av-live-static-ad_cues-golden.mpd b/packager/app/test/testdata/bear-640x360-av-live-static-ad_cues-golden.mpd new file mode 100644 index 0000000000..3c49a432bb --- /dev/null +++ b/packager/app/test/testdata/bear-640x360-av-live-static-ad_cues-golden.mpd @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/packager/app/test/testdata/bear-640x360-av-live-static-golden.mpd b/packager/app/test/testdata/bear-640x360-av-live-static-golden.mpd index c5bc3d7bde..e4abe58270 100644 --- a/packager/app/test/testdata/bear-640x360-av-live-static-golden.mpd +++ b/packager/app/test/testdata/bear-640x360-av-live-static-golden.mpd @@ -13,13 +13,12 @@ - + - - - + + diff --git a/packager/app/test/testdata/bear-640x360-av-mp4-master-cenc-golden.m3u8 b/packager/app/test/testdata/bear-640x360-av-mp4-master-cenc-golden.m3u8 index 82993be545..f6568c261f 100644 --- a/packager/app/test/testdata/bear-640x360-av-mp4-master-cenc-golden.m3u8 +++ b/packager/app/test/testdata/bear-640x360-av-mp4-master-cenc-golden.m3u8 @@ -1,5 +1,5 @@ #EXTM3U ## Generated with https://github.com/google/shaka-packager version -- #EXT-X-MEDIA:TYPE=AUDIO,URI="audio.m3u8",GROUP-ID="audio",NAME="stream_0",AUTOSELECT=YES,CHANNELS="2" -#EXT-X-STREAM-INF:BANDWIDTH=1111147,CODECS="avc1.64001e,mp4a.40.2",RESOLUTION=640x360,AUDIO="audio" +#EXT-X-STREAM-INF:BANDWIDTH=1111340,CODECS="avc1.64001e,mp4a.40.2",RESOLUTION=640x360,AUDIO="audio" video.m3u8 diff --git a/packager/app/test/testdata/bear-640x360-av-mp4-master-golden.m3u8 b/packager/app/test/testdata/bear-640x360-av-mp4-master-golden.m3u8 index d50de13a66..670498660f 100644 --- a/packager/app/test/testdata/bear-640x360-av-mp4-master-golden.m3u8 +++ b/packager/app/test/testdata/bear-640x360-av-mp4-master-golden.m3u8 @@ -1,5 +1,5 @@ #EXTM3U ## Generated with https://github.com/google/shaka-packager version -- #EXT-X-MEDIA:TYPE=AUDIO,URI="audio/audio.m3u8",GROUP-ID="audio",NAME="stream_0",AUTOSELECT=YES,CHANNELS="2" -#EXT-X-STREAM-INF:BANDWIDTH=1105129,CODECS="avc1.64001e,mp4a.40.2",RESOLUTION=640x360,AUDIO="audio" +#EXT-X-STREAM-INF:BANDWIDTH=1105163,CODECS="avc1.64001e,mp4a.40.2",RESOLUTION=640x360,AUDIO="audio" video/video.m3u8 diff --git a/packager/app/test/testdata/bear-640x360-av-trick-1-cenc-golden.mpd b/packager/app/test/testdata/bear-640x360-av-trick-1-cenc-golden.mpd index 982928a4b7..c2a16fa0ef 100644 --- a/packager/app/test/testdata/bear-640x360-av-trick-1-cenc-golden.mpd +++ b/packager/app/test/testdata/bear-640x360-av-trick-1-cenc-golden.mpd @@ -32,7 +32,7 @@ AAAANHBzc2gBAAAAEHfv7MCyTQKs4zweUuL7SwAAAAExMjM0NTY3ODkwMTIzNDU2AAAAAA== - + output_audio.mp4 diff --git a/packager/app/test/testdata/bear-640x360-av-trick-1-trick-2-cenc-golden.mpd b/packager/app/test/testdata/bear-640x360-av-trick-1-trick-2-cenc-golden.mpd index e382bd7c26..6e3f9abbd3 100644 --- a/packager/app/test/testdata/bear-640x360-av-trick-1-trick-2-cenc-golden.mpd +++ b/packager/app/test/testdata/bear-640x360-av-trick-1-trick-2-cenc-golden.mpd @@ -38,7 +38,7 @@ AAAANHBzc2gBAAAAEHfv7MCyTQKs4zweUuL7SwAAAAExMjM0NTY3ODkwMTIzNDU2AAAAAA== - + output_audio.mp4 diff --git a/packager/app/test/testdata/bear-640x360-v-mp4-cenc-ad_cues-golden.m3u8 b/packager/app/test/testdata/bear-640x360-v-mp4-cenc-ad_cues-golden.m3u8 new file mode 100644 index 0000000000..1efedb9889 --- /dev/null +++ b/packager/app/test/testdata/bear-640x360-v-mp4-cenc-ad_cues-golden.m3u8 @@ -0,0 +1,18 @@ +#EXTM3U +#EXT-X-VERSION:6 +## Generated with https://github.com/google/shaka-packager version -- +#EXT-X-TARGETDURATION:2 +#EXT-X-PLAYLIST-TYPE:VOD +#EXT-X-MAP:URI="output_video.mp4",BYTERANGE="1091@0" +#EXT-X-KEY:METHOD=SAMPLE-AES-CENC,URI="data:text/plain;base64,MTIzNDU2Nzg5MDEyMzQ1Ng==",KEYFORMAT="identity" +#EXTINF:1.001, +#EXT-X-BYTERANGE:99313@1159 +output_video.mp4 +#EXTINF:1.001, +#EXT-X-BYTERANGE:122340 +output_video.mp4 +#EXT-X-PLACEMENT-OPPORTUNITY +#EXTINF:0.734, +#EXT-X-BYTERANGE:80067 +output_video.mp4 +#EXT-X-ENDLIST diff --git a/packager/media/base/container_names.cc b/packager/media/base/container_names.cc index 0add6fe957..b679756b86 100644 --- a/packager/media/base/container_names.cc +++ b/packager/media/base/container_names.cc @@ -1755,6 +1755,9 @@ MediaContainerName DetermineContainerFromFileName( } else if (base::EndsWith(file_name, ".ts", base::CompareCase::INSENSITIVE_ASCII)) { return CONTAINER_MPEG2TS; + } else if (base::EndsWith(file_name, ".wvm", + base::CompareCase::INSENSITIVE_ASCII)) { + return CONTAINER_WVM; } else if (base::EndsWith(file_name, ".vtt", base::CompareCase::INSENSITIVE_ASCII)) { return CONTAINER_WEBVTT; diff --git a/packager/media/base/container_names.h b/packager/media/base/container_names.h index 16fb7dc172..897136c33d 100644 --- a/packager/media/base/container_names.h +++ b/packager/media/base/container_names.h @@ -15,47 +15,48 @@ namespace media { /// Container formats supported by this utility function. New formats should be /// added at the end of the list (before CONTAINER_MAX). enum MediaContainerName { - CONTAINER_UNKNOWN, // Unknown - CONTAINER_AAC, // AAC (Advanced Audio Coding) - CONTAINER_AC3, // AC-3 - CONTAINER_AIFF, // AIFF (Audio Interchange File Format) - CONTAINER_AMR, // AMR (Adaptive Multi-Rate Audio) - CONTAINER_APE, // APE (Monkey's Audio) - CONTAINER_ASF, // ASF (Advanced / Active Streaming Format) - CONTAINER_ASS, // SSA (SubStation Alpha) subtitle - CONTAINER_AVI, // AVI (Audio Video Interleaved) - CONTAINER_BINK, // Bink - CONTAINER_CAF, // CAF (Apple Core Audio Format) - CONTAINER_DTS, // DTS - CONTAINER_DTSHD, // DTS-HD - CONTAINER_DV, // DV (Digital Video) - CONTAINER_DXA, // DXA - CONTAINER_EAC3, // Enhanced AC-3 - CONTAINER_FLAC, // FLAC (Free Lossless Audio Codec) - CONTAINER_FLV, // FLV (Flash Video) - CONTAINER_GSM, // GSM (Global System for Mobile Audio) - CONTAINER_H261, // H.261 - CONTAINER_H263, // H.263 - CONTAINER_H264, // H.264 - CONTAINER_HLS, // HLS (Apple HTTP Live Streaming PlayList) - CONTAINER_IRCAM, // Berkeley/IRCAM/CARL Sound Format - CONTAINER_MJPEG, // MJPEG video - CONTAINER_MOV, // QuickTime / MOV / MPEG4 - CONTAINER_MP3, // MP3 (MPEG audio layer 2/3) - CONTAINER_MPEG2PS, // MPEG-2 Program Stream - CONTAINER_MPEG2TS, // MPEG-2 Transport Stream - CONTAINER_MPEG4BS, // MPEG-4 Bitstream - CONTAINER_OGG, // Ogg - CONTAINER_RM, // RM (RealMedia) - CONTAINER_SRT, // SRT (SubRip subtitle) - CONTAINER_SWF, // SWF (ShockWave Flash) - CONTAINER_TTML, // TTML file. - CONTAINER_VC1, // VC-1 - CONTAINER_WAV, // WAV / WAVE (Waveform Audio) - CONTAINER_WEBM, // Matroska / WebM - CONTAINER_WEBVTT, // WebVTT file. - CONTAINER_WTV, // WTV (Windows Television) - CONTAINER_MAX // Must be last + CONTAINER_UNKNOWN, // Unknown + CONTAINER_AAC, // AAC (Advanced Audio Coding) + CONTAINER_AC3, // AC-3 + CONTAINER_AIFF, // AIFF (Audio Interchange File Format) + CONTAINER_AMR, // AMR (Adaptive Multi-Rate Audio) + CONTAINER_APE, // APE (Monkey's Audio) + CONTAINER_ASF, // ASF (Advanced / Active Streaming Format) + CONTAINER_ASS, // SSA (SubStation Alpha) subtitle + CONTAINER_AVI, // AVI (Audio Video Interleaved) + CONTAINER_BINK, // Bink + CONTAINER_CAF, // CAF (Apple Core Audio Format) + CONTAINER_DTS, // DTS + CONTAINER_DTSHD, // DTS-HD + CONTAINER_DV, // DV (Digital Video) + CONTAINER_DXA, // DXA + CONTAINER_EAC3, // Enhanced AC-3 + CONTAINER_FLAC, // FLAC (Free Lossless Audio Codec) + CONTAINER_FLV, // FLV (Flash Video) + CONTAINER_GSM, // GSM (Global System for Mobile Audio) + CONTAINER_H261, // H.261 + CONTAINER_H263, // H.263 + CONTAINER_H264, // H.264 + CONTAINER_HLS, // HLS (Apple HTTP Live Streaming PlayList) + CONTAINER_IRCAM, // Berkeley/IRCAM/CARL Sound Format + CONTAINER_MJPEG, // MJPEG video + CONTAINER_MOV, // QuickTime / MOV / MPEG4 + CONTAINER_MP3, // MP3 (MPEG audio layer 2/3) + CONTAINER_MPEG2PS, // MPEG-2 Program Stream + CONTAINER_MPEG2TS, // MPEG-2 Transport Stream + CONTAINER_MPEG4BS, // MPEG-4 Bitstream + CONTAINER_OGG, // Ogg + CONTAINER_RM, // RM (RealMedia) + CONTAINER_SRT, // SRT (SubRip subtitle) + CONTAINER_SWF, // SWF (ShockWave Flash) + CONTAINER_TTML, // TTML file. + CONTAINER_VC1, // VC-1 + CONTAINER_WAV, // WAV / WAVE (Waveform Audio) + CONTAINER_WEBM, // Matroska / WebM + CONTAINER_WEBVTT, // WebVTT file. + CONTAINER_WTV, // WTV (Windows Television) + CONTAINER_WVM, // WVM (Widevine Classic Format) + CONTAINER_MAX // Must be last }; /// Determine the container type from input data. diff --git a/packager/media/demuxer/demuxer.cc b/packager/media/demuxer/demuxer.cc index cefd48f4d8..82414a4fed 100644 --- a/packager/media/demuxer/demuxer.cc +++ b/packager/media/demuxer/demuxer.cc @@ -14,6 +14,7 @@ #include "packager/file/file.h" #include "packager/media/base/decryptor_source.h" #include "packager/media/base/key_source.h" +#include "packager/media/base/macros.h" #include "packager/media/base/media_sample.h" #include "packager/media/base/stream_info.h" #include "packager/media/formats/mp2t/mp2t_media_parser.h" @@ -186,7 +187,14 @@ Status Demuxer::InitializeParser() { case CONTAINER_MPEG2TS: parser_.reset(new mp2t::Mp2tMediaParser()); break; + // Widevine classic (WVM) is derived from MPEG2PS. We do not support + // non-WVM MPEG2PS file, thus we do not differentiate between the two. + // Every MPEG2PS file is assumed to be WVM file. If it turns out not the + // case, an error will be reported when trying to parse the file as WVM + // file. case CONTAINER_MPEG2PS: + FALLTHROUGH_INTENDED; + case CONTAINER_WVM: parser_.reset(new wvm::WvmMediaParser()); break; case CONTAINER_WEBM: diff --git a/packager/packager.cc b/packager/packager.cc index 06d03cd8f6..be1396823e 100644 --- a/packager/packager.cc +++ b/packager/packager.cc @@ -17,6 +17,7 @@ #include "packager/base/files/file_path.h" #include "packager/base/logging.h" #include "packager/base/path_service.h" +#include "packager/base/strings/string_util.h" #include "packager/base/strings/stringprintf.h" #include "packager/base/threading/simple_thread.h" #include "packager/base/time/clock.h" @@ -583,6 +584,11 @@ Status CreateAudioVideoJobs( // Demuxers are shared among all streams with the same input. std::shared_ptr demuxer; + // Chunkers can be shared among all streams with the same input (except for + // WVM files), which allows samples from the same input to be synced when + // doing chunking. + std::shared_ptr chunker; + bool is_wvm_file = false; // Replicators are shared among all streams with the same input and stream // selector. std::shared_ptr replicator; @@ -592,21 +598,32 @@ Status CreateAudioVideoJobs( for (const StreamDescriptor& stream : streams) { // If we changed our input files, we need a new demuxer. - if (previous_input != stream.input) { + const bool new_input_file = stream.input != previous_input; + if (new_input_file) { Status status = CreateDemuxer(stream, packaging_params, &demuxer); if (!status.ok()) { return status; } job_manager->Add("RemuxJob", demuxer); + + // Share chunkers among all streams with the same input except for WVM + // file, which may contain multiple video files and the samples may not be + // interleaved either. + is_wvm_file = + DetermineContainerFromFileName(stream.input) == CONTAINER_WVM; + if (!is_wvm_file) { + chunker = + std::make_shared(packaging_params.chunking_params); + } } if (!stream.language.empty()) { demuxer->SetLanguageOverride(stream.stream_selector, stream.language); } - const bool new_stream = previous_input != stream.input || - previous_selector != stream.stream_selector; + const bool new_stream = + new_input_file || previous_selector != stream.stream_selector; previous_input = stream.input; previous_selector = stream.stream_selector; @@ -623,14 +640,16 @@ Status CreateAudioVideoJobs( packaging_params.ad_cue_generator_params); } - replicator = std::make_shared(); - - std::shared_ptr chunker = - std::make_shared(packaging_params.chunking_params); + if (is_wvm_file) { + chunker = + std::make_shared(packaging_params.chunking_params); + } std::shared_ptr encryptor = CreateEncryptionHandler( packaging_params, stream, encryption_key_source); + replicator = std::make_shared(); + Status status; if (ad_cue_generator) { status.Update(