diff --git a/docs/source/options/dash_options.rst b/docs/source/options/dash_options.rst index e47ae3774f..d1d6d6782a 100644 --- a/docs/source/options/dash_options.rst +++ b/docs/source/options/dash_options.rst @@ -99,4 +99,9 @@ DASH options --low_latency_dash_mode If enabled, LL-DASH streaming will be used, - reducing overall latency by decoupling latency from segment duration. \ No newline at end of file + reducing overall latency by decoupling latency from segment duration. + +--force_cl_index + + True forces the muxer to order streams in the order given + on the command-line. False uses the previous unordered behavior. \ No newline at end of file diff --git a/docs/source/options/hls_options.rst b/docs/source/options/hls_options.rst index c03e39e751..f3c2b9830b 100644 --- a/docs/source/options/hls_options.rst +++ b/docs/source/options/hls_options.rst @@ -80,3 +80,8 @@ HLS options Optional. Defaults to 0 if not specified. If it is set to 1, indicates the stream is HLS only. + +--force_cl_index + + True forces the muxer to order streams in the order given + on the command-line. False uses the previous unordered behavior. \ No newline at end of file diff --git a/include/packager/packager.h b/include/packager/packager.h index 96fd0b0720..34625381e8 100644 --- a/include/packager/packager.h +++ b/include/packager/packager.h @@ -9,6 +9,7 @@ #include #include +#include #include #include @@ -62,6 +63,7 @@ struct PackagingParams { /// Only use a single thread to generate output. This is useful in tests to /// avoid non-deterministic outputs. bool single_threaded = false; + /// DASH MPD related parameters. MpdParams mpd_params; /// HLS related parameters. @@ -80,6 +82,9 @@ struct PackagingParams { /// Defines a single input/output stream. struct StreamDescriptor { + /// index of the stream to enforce ordering + std::optional index; + /// Input/source media file path or network stream URL. Required. std::string input; diff --git a/packager/app/manifest_flags.cc b/packager/app/manifest_flags.cc index dc72fb3ed6..0a6c97ffe5 100644 --- a/packager/app/manifest_flags.cc +++ b/packager/app/manifest_flags.cc @@ -37,3 +37,8 @@ ABSL_FLAG(std::string, "", "Same as above, but this applies to text tracks only, and " "overrides the default language for text tracks."); +ABSL_FLAG(bool, + force_cl_index, + true, + "True forces the muxer to order streams in the order given " + "on the command-line. False uses the previous unordered behavior."); diff --git a/packager/app/manifest_flags.h b/packager/app/manifest_flags.h index 59b6507df4..77296a0868 100644 --- a/packager/app/manifest_flags.h +++ b/packager/app/manifest_flags.h @@ -16,5 +16,6 @@ ABSL_DECLARE_FLAG(double, time_shift_buffer_depth); ABSL_DECLARE_FLAG(uint64_t, preserved_segments_outside_live_window); ABSL_DECLARE_FLAG(std::string, default_language); ABSL_DECLARE_FLAG(std::string, default_text_language); +ABSL_DECLARE_FLAG(bool, force_cl_index); #endif // PACKAGER_APP_MANIFEST_FLAGS_H_ diff --git a/packager/app/packager_main.cc b/packager/app/packager_main.cc index 99ad69e84c..5c45c32dc8 100644 --- a/packager/app/packager_main.cc +++ b/packager/app/packager_main.cc @@ -583,6 +583,14 @@ int PackagerMain(int argc, char** argv) { return kArgumentValidationFailed; stream_descriptors.push_back(stream_descriptor.value()); } + + if (absl::GetFlag(FLAGS_force_cl_index)) { + int index = 0; + for (auto& descriptor : stream_descriptors) { + descriptor.index = index++; + } + } + Packager packager; Status status = packager.Initialize(packaging_params.value(), stream_descriptors); diff --git a/packager/app/test/packager_test.py b/packager/app/test/packager_test.py index 1640de409f..8e2b805203 100755 --- a/packager/app/test/packager_test.py +++ b/packager/app/test/packager_test.py @@ -474,7 +474,9 @@ class PackagerAppTest(unittest.TestCase): segment_duration=1.0, use_fake_clock=True, allow_codec_switching=False, - dash_force_segment_list=False): + dash_force_segment_list=False, + force_cl_index=False): + flags = ['--single_threaded'] if not strip_parameter_set_nalus: @@ -558,6 +560,9 @@ class PackagerAppTest(unittest.TestCase): if allow_codec_switching: flags += ['--allow_codec_switching'] + if force_cl_index: + flags += ['--force_cl_index'] + if ad_cues: flags += ['--ad_cues', ad_cues] @@ -1657,6 +1662,49 @@ class PackagerFunctionalTest(PackagerAppTest): self._CheckTestResults( 'audio-video-with-codec-switching-encryption-trick-play') + def testForcedCommandlineOrdering(self): + streams = [ + self._GetStream('text', test_file='bear-english.vtt'), + self._GetStream('audio', test_file='bear-640x360.mp4'), + self._GetStream('video', test_file='bear-640x360-hevc.mp4'), + self._GetStream('video', test_file='bear-1280x720.mp4'), + self._GetStream('video', test_file='bear-640x360.mp4'), + ] + + self.assertPackageSuccess(streams, + self._GetFlags(output_dash=True, output_hls=True, + force_cl_index=True)) + self._CheckTestResults('forced-commandline-ordering') + + def testAllowCodecSwitchingWithCommandlineOrdering(self): + streams = [ + self._GetStream('audio', test_file='bear-640x360.mp4'), + self._GetStream('video', test_file='bear-640x360-hevc.mp4'), + self._GetStream('video', test_file='bear-640x360.mp4'), + self._GetStream('video', test_file='bear-1280x720.mp4'), + ] + + self.assertPackageSuccess(streams, + self._GetFlags(output_dash=True, + allow_codec_switching=True, + force_cl_index=True)) + self._CheckTestResults( + 'audio-video-with-codec-switching-and-forced-commandline_order') + + def testAudioVideoWithTrickPlayAndCommandlineOrdering(self): + streams = [ + self._GetStream('audio', test_file='bear-640x360.mp4'), + self._GetStream('video', test_file='bear-640x360-hevc.mp4'), + self._GetStream('video', test_file='bear-640x360.mp4'), + self._GetStream('video', test_file='bear-1280x720.mp4', + trick_play_factor=1), + ] + + self.assertPackageSuccess(streams, self._GetFlags(output_dash=True, + force_cl_index=True)) + self._CheckTestResults( + 'audio-video-with-trick-play-and-forced-commandline-order') + def testLiveProfileAndEncryption(self): self.assertPackageSuccess( self._GetStreams(['audio', 'video'], segmented=True), diff --git a/packager/app/test/testdata/audio-video-with-accessibilities-and-roles/output.mpd b/packager/app/test/testdata/audio-video-with-accessibilities-and-roles/output.mpd index a30e38de93..32c93b2fe7 100644 --- a/packager/app/test/testdata/audio-video-with-accessibilities-and-roles/output.mpd +++ b/packager/app/test/testdata/audio-video-with-accessibilities-and-roles/output.mpd @@ -2,18 +2,10 @@ - - - bear-640x360-video.mp4 - - - - - - + - + bear-640x360-audio.mp4 @@ -21,6 +13,14 @@ + + + bear-640x360-video.mp4 + + + + + diff --git a/packager/app/test/testdata/audio-video-with-codec-switching-and-forced-commandline_order/bear-1280x720-video.mp4 b/packager/app/test/testdata/audio-video-with-codec-switching-and-forced-commandline_order/bear-1280x720-video.mp4 new file mode 100644 index 0000000000..eb0e007054 Binary files /dev/null and b/packager/app/test/testdata/audio-video-with-codec-switching-and-forced-commandline_order/bear-1280x720-video.mp4 differ diff --git a/packager/app/test/testdata/audio-video-with-codec-switching-and-forced-commandline_order/bear-640x360-audio.mp4 b/packager/app/test/testdata/audio-video-with-codec-switching-and-forced-commandline_order/bear-640x360-audio.mp4 new file mode 100644 index 0000000000..10077f9af8 Binary files /dev/null and b/packager/app/test/testdata/audio-video-with-codec-switching-and-forced-commandline_order/bear-640x360-audio.mp4 differ diff --git a/packager/app/test/testdata/audio-video-with-codec-switching-and-forced-commandline_order/bear-640x360-hevc-video.mp4 b/packager/app/test/testdata/audio-video-with-codec-switching-and-forced-commandline_order/bear-640x360-hevc-video.mp4 new file mode 100644 index 0000000000..9efb29c9f2 Binary files /dev/null and b/packager/app/test/testdata/audio-video-with-codec-switching-and-forced-commandline_order/bear-640x360-hevc-video.mp4 differ diff --git a/packager/app/test/testdata/audio-video-with-codec-switching-and-forced-commandline_order/bear-640x360-video.mp4 b/packager/app/test/testdata/audio-video-with-codec-switching-and-forced-commandline_order/bear-640x360-video.mp4 new file mode 100644 index 0000000000..de83807979 Binary files /dev/null and b/packager/app/test/testdata/audio-video-with-codec-switching-and-forced-commandline_order/bear-640x360-video.mp4 differ diff --git a/packager/app/test/testdata/audio-video-with-codec-switching-and-forced-commandline_order/output.mpd b/packager/app/test/testdata/audio-video-with-codec-switching-and-forced-commandline_order/output.mpd new file mode 100644 index 0000000000..4dbb0e2019 --- /dev/null +++ b/packager/app/test/testdata/audio-video-with-codec-switching-and-forced-commandline_order/output.mpd @@ -0,0 +1,41 @@ + + + + + + + + bear-640x360-audio.mp4 + + + + + + + + + + bear-640x360-hevc-video.mp4 + + + + + + + + + + bear-640x360-video.mp4 + + + + + + bear-1280x720-video.mp4 + + + + + + + diff --git a/packager/app/test/testdata/audio-video-with-codec-switching-encryption-trick-play/output.mpd b/packager/app/test/testdata/audio-video-with-codec-switching-encryption-trick-play/output.mpd index c9bfd7679b..d33134418d 100644 --- a/packager/app/test/testdata/audio-video-with-codec-switching-encryption-trick-play/output.mpd +++ b/packager/app/test/testdata/audio-video-with-codec-switching-encryption-trick-play/output.mpd @@ -2,50 +2,50 @@ - + AAAANHBzc2gBAAAAEHfv7MCyTQKs4zweUuL7SwAAAAExMjM0NTY3ODkwMTIzNDU2AAAAAA== - + - - bear-1280x720-video.mp4 - - - - - - bear-640x360-video.mp4 - - + + bear-640x360-hevc-video.mp4 + + - - - - AAAANHBzc2gBAAAAEHfv7MCyTQKs4zweUuL7SwAAAAExMjM0NTY3ODkwMTIzNDU2AAAAAA== - - - - bear-1280x720-video-trick_play_factor_1.mp4 - - - - - - + AAAANHBzc2gBAAAAEHfv7MCyTQKs4zweUuL7SwAAAAExMjM0NTY3ODkwMTIzNDU2AAAAAA== - - bear-640x360-hevc-video.mp4 - - + + bear-640x360-video.mp4 + + + + + + bear-1280x720-video.mp4 + + + + + + + + + AAAANHBzc2gBAAAAEHfv7MCyTQKs4zweUuL7SwAAAAExMjM0NTY3ODkwMTIzNDU2AAAAAA== + + + + bear-1280x720-video-trick_play_factor_1.mp4 + + diff --git a/packager/app/test/testdata/audio-video-with-codec-switching/output.mpd b/packager/app/test/testdata/audio-video-with-codec-switching/output.mpd index b8f3e3ebfb..63c949e4d6 100644 --- a/packager/app/test/testdata/audio-video-with-codec-switching/output.mpd +++ b/packager/app/test/testdata/audio-video-with-codec-switching/output.mpd @@ -2,29 +2,29 @@ - + - - bear-1280x720-video.mp4 - - + + bear-640x360-hevc-video.mp4 + + - + + + + + bear-640x360-video.mp4 - - - - - - bear-640x360-hevc-video.mp4 - - + + bear-1280x720-video.mp4 + + diff --git a/packager/app/test/testdata/audio-video-with-language-override-with-subtag/output.mpd b/packager/app/test/testdata/audio-video-with-language-override-with-subtag/output.mpd index c4444c6813..e3bd7b5a80 100644 --- a/packager/app/test/testdata/audio-video-with-language-override-with-subtag/output.mpd +++ b/packager/app/test/testdata/audio-video-with-language-override-with-subtag/output.mpd @@ -2,16 +2,8 @@ - - - bear-640x360-video.mp4 - - - - - - - + + bear-640x360-audio.mp4 @@ -19,5 +11,13 @@ + + + bear-640x360-video.mp4 + + + + + diff --git a/packager/app/test/testdata/audio-video-with-language-override/output.mpd b/packager/app/test/testdata/audio-video-with-language-override/output.mpd index ca1414da97..3a04fe7567 100644 --- a/packager/app/test/testdata/audio-video-with-language-override/output.mpd +++ b/packager/app/test/testdata/audio-video-with-language-override/output.mpd @@ -2,17 +2,9 @@ - - - bear-640x360-video.mp4 - - - - - - + - + bear-640x360-audio.mp4 @@ -20,5 +12,13 @@ + + + bear-640x360-video.mp4 + + + + + diff --git a/packager/app/test/testdata/audio-video-with-trick-play-and-forced-commandline-order/bear-1280x720-video-trick_play_factor_1.mp4 b/packager/app/test/testdata/audio-video-with-trick-play-and-forced-commandline-order/bear-1280x720-video-trick_play_factor_1.mp4 new file mode 100644 index 0000000000..8690215ac2 Binary files /dev/null and b/packager/app/test/testdata/audio-video-with-trick-play-and-forced-commandline-order/bear-1280x720-video-trick_play_factor_1.mp4 differ diff --git a/packager/app/test/testdata/audio-video-with-trick-play-and-forced-commandline-order/bear-640x360-audio.mp4 b/packager/app/test/testdata/audio-video-with-trick-play-and-forced-commandline-order/bear-640x360-audio.mp4 new file mode 100644 index 0000000000..10077f9af8 Binary files /dev/null and b/packager/app/test/testdata/audio-video-with-trick-play-and-forced-commandline-order/bear-640x360-audio.mp4 differ diff --git a/packager/app/test/testdata/audio-video-with-trick-play-and-forced-commandline-order/bear-640x360-hevc-video.mp4 b/packager/app/test/testdata/audio-video-with-trick-play-and-forced-commandline-order/bear-640x360-hevc-video.mp4 new file mode 100644 index 0000000000..9efb29c9f2 Binary files /dev/null and b/packager/app/test/testdata/audio-video-with-trick-play-and-forced-commandline-order/bear-640x360-hevc-video.mp4 differ diff --git a/packager/app/test/testdata/audio-video-with-trick-play-and-forced-commandline-order/bear-640x360-video.mp4 b/packager/app/test/testdata/audio-video-with-trick-play-and-forced-commandline-order/bear-640x360-video.mp4 new file mode 100644 index 0000000000..de83807979 Binary files /dev/null and b/packager/app/test/testdata/audio-video-with-trick-play-and-forced-commandline-order/bear-640x360-video.mp4 differ diff --git a/packager/app/test/testdata/audio-video-with-trick-play-and-forced-commandline-order/output.mpd b/packager/app/test/testdata/audio-video-with-trick-play-and-forced-commandline-order/output.mpd new file mode 100644 index 0000000000..3e6bb8c966 --- /dev/null +++ b/packager/app/test/testdata/audio-video-with-trick-play-and-forced-commandline-order/output.mpd @@ -0,0 +1,40 @@ + + + + + + + + bear-640x360-audio.mp4 + + + + + + + + bear-640x360-hevc-video.mp4 + + + + + + + + bear-640x360-video.mp4 + + + + + + + + + bear-1280x720-video-trick_play_factor_1.mp4 + + + + + + + diff --git a/packager/app/test/testdata/audio-video-with-trick-play/output.mpd b/packager/app/test/testdata/audio-video-with-trick-play/output.mpd index e7a8328004..f2ed8f3c10 100644 --- a/packager/app/test/testdata/audio-video-with-trick-play/output.mpd +++ b/packager/app/test/testdata/audio-video-with-trick-play/output.mpd @@ -2,25 +2,8 @@ - - - bear-640x360-video.mp4 - - - - - - - - - bear-640x360-video-trick_play_factor_1.mp4 - - - - - - - + + bear-640x360-audio.mp4 @@ -28,5 +11,22 @@ + + + bear-640x360-video.mp4 + + + + + + + + + bear-640x360-video-trick_play_factor_1.mp4 + + + + + diff --git a/packager/app/test/testdata/audio-video-with-two-trick-play/output.mpd b/packager/app/test/testdata/audio-video-with-two-trick-play/output.mpd index 71da79f00e..560d57adaf 100644 --- a/packager/app/test/testdata/audio-video-with-two-trick-play/output.mpd +++ b/packager/app/test/testdata/audio-video-with-two-trick-play/output.mpd @@ -2,31 +2,8 @@ - - - bear-640x360-video.mp4 - - - - - - - - - bear-640x360-video-trick_play_factor_1.mp4 - - - - - - bear-640x360-video-trick_play_factor_2.mp4 - - - - - - - + + bear-640x360-audio.mp4 @@ -34,5 +11,28 @@ + + + bear-640x360-video.mp4 + + + + + + + + + bear-640x360-video-trick_play_factor_2.mp4 + + + + + + bear-640x360-video-trick_play_factor_1.mp4 + + + + + diff --git a/packager/app/test/testdata/audio-video/output.mpd b/packager/app/test/testdata/audio-video/output.mpd index e6b902a8b4..ba7a0c5612 100644 --- a/packager/app/test/testdata/audio-video/output.mpd +++ b/packager/app/test/testdata/audio-video/output.mpd @@ -2,16 +2,8 @@ - - - bear-640x360-video.mp4 - - - - - - - + + bear-640x360-audio.mp4 @@ -19,5 +11,13 @@ + + + bear-640x360-video.mp4 + + + + + diff --git a/packager/app/test/testdata/avc-aac-ts/output.mpd b/packager/app/test/testdata/avc-aac-ts/output.mpd index 268efb85f1..65a525535e 100644 --- a/packager/app/test/testdata/avc-aac-ts/output.mpd +++ b/packager/app/test/testdata/avc-aac-ts/output.mpd @@ -2,18 +2,8 @@ - - - - - - - - - - - - + + @@ -24,5 +14,15 @@ + + + + + + + + + + diff --git a/packager/app/test/testdata/bandwidth-override/output.mpd b/packager/app/test/testdata/bandwidth-override/output.mpd index b685d9e7b3..dd59d81a02 100644 --- a/packager/app/test/testdata/bandwidth-override/output.mpd +++ b/packager/app/test/testdata/bandwidth-override/output.mpd @@ -2,16 +2,8 @@ - - - bear-640x360-video.mp4 - - - - - - - + + bear-640x360-audio.mp4 @@ -19,5 +11,13 @@ + + + bear-640x360-video.mp4 + + + + + diff --git a/packager/app/test/testdata/dolby-vision-profile-8-with-encryption/output.mpd b/packager/app/test/testdata/dolby-vision-profile-8-with-encryption/output.mpd index 2d60320f4f..0acbe5ca43 100644 --- a/packager/app/test/testdata/dolby-vision-profile-8-with-encryption/output.mpd +++ b/packager/app/test/testdata/dolby-vision-profile-8-with-encryption/output.mpd @@ -21,7 +21,7 @@ AAAANHBzc2gBAAAAEHfv7MCyTQKs4zweUuL7SwAAAAExMjM0NTY3ODkwMTIzNDU2AAAAAA== - + sparks_dovi_8-video.mp4 diff --git a/packager/app/test/testdata/encryption-and-ad-cues-split-content/output.mpd b/packager/app/test/testdata/encryption-and-ad-cues-split-content/output.mpd index a19ded84d4..d3f3269f48 100644 --- a/packager/app/test/testdata/encryption-and-ad-cues-split-content/output.mpd +++ b/packager/app/test/testdata/encryption-and-ad-cues-split-content/output.mpd @@ -2,24 +2,12 @@ - + AAAANHBzc2gBAAAAEHfv7MCyTQKs4zweUuL7SwAAAAExMjM0NTY3ODkwMTIzNDU2AAAAAA== - - bear-640x360-video1.mp4 - - - - - - - - - AAAANHBzc2gBAAAAEHfv7MCyTQKs4zweUuL7SwAAAAExMjM0NTY3ODkwMTIzNDU2AAAAAA== - - + bear-640x360-audio1.mp4 @@ -27,26 +15,26 @@ - - - + AAAANHBzc2gBAAAAEHfv7MCyTQKs4zweUuL7SwAAAAExMjM0NTY3ODkwMTIzNDU2AAAAAA== - - bear-640x360-video2.mp4 - + + bear-640x360-video1.mp4 + - + + + AAAANHBzc2gBAAAAEHfv7MCyTQKs4zweUuL7SwAAAAExMjM0NTY3ODkwMTIzNDU2AAAAAA== - + bear-640x360-audio2.mp4 @@ -54,5 +42,17 @@ + + + + AAAANHBzc2gBAAAAEHfv7MCyTQKs4zweUuL7SwAAAAExMjM0NTY3ODkwMTIzNDU2AAAAAA== + + + bear-640x360-video2.mp4 + + + + + diff --git a/packager/app/test/testdata/encryption-and-no-clear-lead/output.mpd b/packager/app/test/testdata/encryption-and-no-clear-lead/output.mpd index 4f93832bbf..494ba28b60 100644 --- a/packager/app/test/testdata/encryption-and-no-clear-lead/output.mpd +++ b/packager/app/test/testdata/encryption-and-no-clear-lead/output.mpd @@ -2,24 +2,12 @@ - + AAAANHBzc2gBAAAAEHfv7MCyTQKs4zweUuL7SwAAAAExMjM0NTY3ODkwMTIzNDU2AAAAAA== - - bear-640x360-video.mp4 - - - - - - - - - AAAANHBzc2gBAAAAEHfv7MCyTQKs4zweUuL7SwAAAAExMjM0NTY3ODkwMTIzNDU2AAAAAA== - - + bear-640x360-audio.mp4 @@ -27,5 +15,17 @@ + + + + AAAANHBzc2gBAAAAEHfv7MCyTQKs4zweUuL7SwAAAAExMjM0NTY3ODkwMTIzNDU2AAAAAA== + + + bear-640x360-video.mp4 + + + + + diff --git a/packager/app/test/testdata/encryption-and-no-pssh-in-stream/output.mpd b/packager/app/test/testdata/encryption-and-no-pssh-in-stream/output.mpd index 7ec0b23825..0dc8b94c8d 100644 --- a/packager/app/test/testdata/encryption-and-no-pssh-in-stream/output.mpd +++ b/packager/app/test/testdata/encryption-and-no-pssh-in-stream/output.mpd @@ -2,24 +2,12 @@ - + AAAANHBzc2gBAAAAEHfv7MCyTQKs4zweUuL7SwAAAAExMjM0NTY3ODkwMTIzNDU2AAAAAA== - - bear-640x360-video.mp4 - - - - - - - - - AAAANHBzc2gBAAAAEHfv7MCyTQKs4zweUuL7SwAAAAExMjM0NTY3ODkwMTIzNDU2AAAAAA== - - + bear-640x360-audio.mp4 @@ -27,5 +15,17 @@ + + + + AAAANHBzc2gBAAAAEHfv7MCyTQKs4zweUuL7SwAAAAExMjM0NTY3ODkwMTIzNDU2AAAAAA== + + + bear-640x360-video.mp4 + + + + + diff --git a/packager/app/test/testdata/encryption-and-non-dash-if-iop/output.mpd b/packager/app/test/testdata/encryption-and-non-dash-if-iop/output.mpd index 32872a8c37..cf597e8577 100644 --- a/packager/app/test/testdata/encryption-and-non-dash-if-iop/output.mpd +++ b/packager/app/test/testdata/encryption-and-non-dash-if-iop/output.mpd @@ -2,20 +2,8 @@ - - - - - AAAANHBzc2gBAAAAEHfv7MCyTQKs4zweUuL7SwAAAAExMjM0NTY3ODkwMTIzNDU2AAAAAA== - - bear-640x360-video.mp4 - - - - - - - + + @@ -27,5 +15,17 @@ + + + + + AAAANHBzc2gBAAAAEHfv7MCyTQKs4zweUuL7SwAAAAExMjM0NTY3ODkwMTIzNDU2AAAAAA== + + bear-640x360-video.mp4 + + + + + diff --git a/packager/app/test/testdata/encryption-and-trick-play/output.mpd b/packager/app/test/testdata/encryption-and-trick-play/output.mpd index 79309e93e2..1553fb6375 100644 --- a/packager/app/test/testdata/encryption-and-trick-play/output.mpd +++ b/packager/app/test/testdata/encryption-and-trick-play/output.mpd @@ -2,37 +2,12 @@ - + AAAANHBzc2gBAAAAEHfv7MCyTQKs4zweUuL7SwAAAAExMjM0NTY3ODkwMTIzNDU2AAAAAA== - - bear-640x360-video.mp4 - - - - - - - - - AAAANHBzc2gBAAAAEHfv7MCyTQKs4zweUuL7SwAAAAExMjM0NTY3ODkwMTIzNDU2AAAAAA== - - - - bear-640x360-video-trick_play_factor_1.mp4 - - - - - - - - - AAAANHBzc2gBAAAAEHfv7MCyTQKs4zweUuL7SwAAAAExMjM0NTY3ODkwMTIzNDU2AAAAAA== - - + bear-640x360-audio.mp4 @@ -40,5 +15,30 @@ + + + + AAAANHBzc2gBAAAAEHfv7MCyTQKs4zweUuL7SwAAAAExMjM0NTY3ODkwMTIzNDU2AAAAAA== + + + bear-640x360-video.mp4 + + + + + + + + + AAAANHBzc2gBAAAAEHfv7MCyTQKs4zweUuL7SwAAAAExMjM0NTY3ODkwMTIzNDU2AAAAAA== + + + + bear-640x360-video-trick_play_factor_1.mp4 + + + + + diff --git a/packager/app/test/testdata/encryption-and-two-trick-plays/output.mpd b/packager/app/test/testdata/encryption-and-two-trick-plays/output.mpd index 50d8694fc1..d0023219bb 100644 --- a/packager/app/test/testdata/encryption-and-two-trick-plays/output.mpd +++ b/packager/app/test/testdata/encryption-and-two-trick-plays/output.mpd @@ -2,43 +2,12 @@ - + AAAANHBzc2gBAAAAEHfv7MCyTQKs4zweUuL7SwAAAAExMjM0NTY3ODkwMTIzNDU2AAAAAA== - - bear-640x360-video.mp4 - - - - - - - - - AAAANHBzc2gBAAAAEHfv7MCyTQKs4zweUuL7SwAAAAExMjM0NTY3ODkwMTIzNDU2AAAAAA== - - - - bear-640x360-video-trick_play_factor_1.mp4 - - - - - - bear-640x360-video-trick_play_factor_2.mp4 - - - - - - - - - AAAANHBzc2gBAAAAEHfv7MCyTQKs4zweUuL7SwAAAAExMjM0NTY3ODkwMTIzNDU2AAAAAA== - - + bear-640x360-audio.mp4 @@ -46,5 +15,36 @@ + + + + AAAANHBzc2gBAAAAEHfv7MCyTQKs4zweUuL7SwAAAAExMjM0NTY3ODkwMTIzNDU2AAAAAA== + + + bear-640x360-video.mp4 + + + + + + + + + AAAANHBzc2gBAAAAEHfv7MCyTQKs4zweUuL7SwAAAAExMjM0NTY3ODkwMTIzNDU2AAAAAA== + + + + bear-640x360-video-trick_play_factor_1.mp4 + + + + + + bear-640x360-video-trick_play_factor_2.mp4 + + + + + diff --git a/packager/app/test/testdata/encryption-cbc-1/output.mpd b/packager/app/test/testdata/encryption-cbc-1/output.mpd index e5036866dc..c54248a533 100644 --- a/packager/app/test/testdata/encryption-cbc-1/output.mpd +++ b/packager/app/test/testdata/encryption-cbc-1/output.mpd @@ -2,24 +2,12 @@ - + AAAANHBzc2gBAAAAEHfv7MCyTQKs4zweUuL7SwAAAAExMjM0NTY3ODkwMTIzNDU2AAAAAA== - - bear-640x360-video.mp4 - - - - - - - - - AAAANHBzc2gBAAAAEHfv7MCyTQKs4zweUuL7SwAAAAExMjM0NTY3ODkwMTIzNDU2AAAAAA== - - + bear-640x360-audio.mp4 @@ -27,5 +15,17 @@ + + + + AAAANHBzc2gBAAAAEHfv7MCyTQKs4zweUuL7SwAAAAExMjM0NTY3ODkwMTIzNDU2AAAAAA== + + + bear-640x360-video.mp4 + + + + + diff --git a/packager/app/test/testdata/encryption-cbcs-with-full-protection/output.mpd b/packager/app/test/testdata/encryption-cbcs-with-full-protection/output.mpd index 64ab2480a7..2686f8be43 100644 --- a/packager/app/test/testdata/encryption-cbcs-with-full-protection/output.mpd +++ b/packager/app/test/testdata/encryption-cbcs-with-full-protection/output.mpd @@ -2,24 +2,12 @@ - + AAAANHBzc2gBAAAAEHfv7MCyTQKs4zweUuL7SwAAAAExMjM0NTY3ODkwMTIzNDU2AAAAAA== - - bear-640x360-video.mp4 - - - - - - - - - AAAANHBzc2gBAAAAEHfv7MCyTQKs4zweUuL7SwAAAAExMjM0NTY3ODkwMTIzNDU2AAAAAA== - - + bear-640x360-audio.mp4 @@ -27,5 +15,17 @@ + + + + AAAANHBzc2gBAAAAEHfv7MCyTQKs4zweUuL7SwAAAAExMjM0NTY3ODkwMTIzNDU2AAAAAA== + + + bear-640x360-video.mp4 + + + + + diff --git a/packager/app/test/testdata/encryption-cbcs/output.mpd b/packager/app/test/testdata/encryption-cbcs/output.mpd index 64ab2480a7..2686f8be43 100644 --- a/packager/app/test/testdata/encryption-cbcs/output.mpd +++ b/packager/app/test/testdata/encryption-cbcs/output.mpd @@ -2,24 +2,12 @@ - + AAAANHBzc2gBAAAAEHfv7MCyTQKs4zweUuL7SwAAAAExMjM0NTY3ODkwMTIzNDU2AAAAAA== - - bear-640x360-video.mp4 - - - - - - - - - AAAANHBzc2gBAAAAEHfv7MCyTQKs4zweUuL7SwAAAAExMjM0NTY3ODkwMTIzNDU2AAAAAA== - - + bear-640x360-audio.mp4 @@ -27,5 +15,17 @@ + + + + AAAANHBzc2gBAAAAEHfv7MCyTQKs4zweUuL7SwAAAAExMjM0NTY3ODkwMTIzNDU2AAAAAA== + + + bear-640x360-video.mp4 + + + + + diff --git a/packager/app/test/testdata/encryption-cens/output.mpd b/packager/app/test/testdata/encryption-cens/output.mpd index bc41e3abb1..7637e41a5d 100644 --- a/packager/app/test/testdata/encryption-cens/output.mpd +++ b/packager/app/test/testdata/encryption-cens/output.mpd @@ -2,24 +2,12 @@ - + AAAANHBzc2gBAAAAEHfv7MCyTQKs4zweUuL7SwAAAAExMjM0NTY3ODkwMTIzNDU2AAAAAA== - - bear-640x360-video.mp4 - - - - - - - - - AAAANHBzc2gBAAAAEHfv7MCyTQKs4zweUuL7SwAAAAExMjM0NTY3ODkwMTIzNDU2AAAAAA== - - + bear-640x360-audio.mp4 @@ -27,5 +15,17 @@ + + + + AAAANHBzc2gBAAAAEHfv7MCyTQKs4zweUuL7SwAAAAExMjM0NTY3ODkwMTIzNDU2AAAAAA== + + + bear-640x360-video.mp4 + + + + + diff --git a/packager/app/test/testdata/encryption-multi-keys-with-stream-label/output.mpd b/packager/app/test/testdata/encryption-multi-keys-with-stream-label/output.mpd index f9895e6172..dd35a56c54 100644 --- a/packager/app/test/testdata/encryption-multi-keys-with-stream-label/output.mpd +++ b/packager/app/test/testdata/encryption-multi-keys-with-stream-label/output.mpd @@ -2,24 +2,12 @@ - - - - AAAARHBzc2gBAAAAEHfv7MCyTQKs4zweUuL7SwAAAAIQERITFBUWFxgZICEiIyQlICEiIyQlJicoKTAxMjM0NQAAAAA= - - - bear-640x360-video.mp4 - - - - - - + AAAARHBzc2gBAAAAEHfv7MCyTQKs4zweUuL7SwAAAAIQERITFBUWFxgZICEiIyQlICEiIyQlJicoKTAxMjM0NQAAAAA= - + bear-640x360-audio.mp4 @@ -27,5 +15,17 @@ + + + + AAAARHBzc2gBAAAAEHfv7MCyTQKs4zweUuL7SwAAAAIQERITFBUWFxgZICEiIyQlICEiIyQlJicoKTAxMjM0NQAAAAA= + + + bear-640x360-video.mp4 + + + + + diff --git a/packager/app/test/testdata/encryption-multi-keys/output.mpd b/packager/app/test/testdata/encryption-multi-keys/output.mpd index d7ff0808c1..96cde0c744 100644 --- a/packager/app/test/testdata/encryption-multi-keys/output.mpd +++ b/packager/app/test/testdata/encryption-multi-keys/output.mpd @@ -2,24 +2,12 @@ - - - - AAAARHBzc2gBAAAAEHfv7MCyTQKs4zweUuL7SwAAAAIQERITFBUWFxgZICEiIyQlICEiIyQlJicoKTAxMjM0NQAAAAA= - - - bear-640x360-video.mp4 - - - - - - + AAAARHBzc2gBAAAAEHfv7MCyTQKs4zweUuL7SwAAAAIQERITFBUWFxgZICEiIyQlICEiIyQlJicoKTAxMjM0NQAAAAA= - + bear-640x360-audio.mp4 @@ -27,5 +15,17 @@ + + + + AAAARHBzc2gBAAAAEHfv7MCyTQKs4zweUuL7SwAAAAIQERITFBUWFxgZICEiIyQlICEiIyQlJicoKTAxMjM0NQAAAAA= + + + bear-640x360-video.mp4 + + + + + diff --git a/packager/app/test/testdata/encryption-of-only-video-stream/output.mpd b/packager/app/test/testdata/encryption-of-only-video-stream/output.mpd index 49ee7d7ea2..cc004536d5 100644 --- a/packager/app/test/testdata/encryption-of-only-video-stream/output.mpd +++ b/packager/app/test/testdata/encryption-of-only-video-stream/output.mpd @@ -2,20 +2,8 @@ - - - - AAAANHBzc2gBAAAAEHfv7MCyTQKs4zweUuL7SwAAAAExMjM0NTY3ODkwMTIzNDU2AAAAAA== - - - bear-640x360-video.mp4 - - - - - - - + + bear-640x360-audio-skip_encryption.mp4 @@ -23,5 +11,17 @@ + + + + AAAANHBzc2gBAAAAEHfv7MCyTQKs4zweUuL7SwAAAAExMjM0NTY3ODkwMTIzNDU2AAAAAA== + + + bear-640x360-video.mp4 + + + + + diff --git a/packager/app/test/testdata/encryption-using-explicit-pssh/output.mpd b/packager/app/test/testdata/encryption-using-explicit-pssh/output.mpd index 74bcb78540..1b40fefc95 100644 --- a/packager/app/test/testdata/encryption-using-explicit-pssh/output.mpd +++ b/packager/app/test/testdata/encryption-using-explicit-pssh/output.mpd @@ -2,24 +2,12 @@ - + AAAAIHBzc2gAAAAAEHfv7MCyTQKs4zweUuL7SwAAAAA= - - bear-640x360-video.mp4 - - - - - - - - - AAAAIHBzc2gAAAAAEHfv7MCyTQKs4zweUuL7SwAAAAA= - - + bear-640x360-audio.mp4 @@ -27,5 +15,17 @@ + + + + AAAAIHBzc2gAAAAAEHfv7MCyTQKs4zweUuL7SwAAAAA= + + + bear-640x360-video.mp4 + + + + + diff --git a/packager/app/test/testdata/encryption-using-fixed-key/output.mpd b/packager/app/test/testdata/encryption-using-fixed-key/output.mpd index ffe39e9ffc..3d496a56ce 100644 --- a/packager/app/test/testdata/encryption-using-fixed-key/output.mpd +++ b/packager/app/test/testdata/encryption-using-fixed-key/output.mpd @@ -2,24 +2,12 @@ - + AAAANHBzc2gBAAAAEHfv7MCyTQKs4zweUuL7SwAAAAExMjM0NTY3ODkwMTIzNDU2AAAAAA== - - bear-640x360-video.mp4 - - - - - - - - - AAAANHBzc2gBAAAAEHfv7MCyTQKs4zweUuL7SwAAAAExMjM0NTY3ODkwMTIzNDU2AAAAAA== - - + bear-640x360-audio.mp4 @@ -27,5 +15,17 @@ + + + + AAAANHBzc2gBAAAAEHfv7MCyTQKs4zweUuL7SwAAAAExMjM0NTY3ODkwMTIzNDU2AAAAAA== + + + bear-640x360-video.mp4 + + + + + diff --git a/packager/app/test/testdata/encryption-with-multi-drms/output.mpd b/packager/app/test/testdata/encryption-with-multi-drms/output.mpd index ba247e8498..aed997af74 100644 --- a/packager/app/test/testdata/encryption-with-multi-drms/output.mpd +++ b/packager/app/test/testdata/encryption-with-multi-drms/output.mpd @@ -2,7 +2,7 @@ - + AAACJnBzc2gAAAAAmgTweZhAQoarkuZb4IhflQAAAgYGAgAAAQABAPwBPABXAFIATQBIAEUAQQBEAEUAUgAgAHgAbQBsAG4AcwA9ACIAaAB0AHQAcAA6AC8ALwBzAGMAaABlAG0AYQBzAC4AbQBpAGMAcgBvAHMAbwBmAHQALgBjAG8AbQAvAEQAUgBNAC8AMgAwADAANwAvADAAMwAvAFAAbABhAHkAUgBlAGEAZAB5AEgAZQBhAGQAZQByACIAIAB2AGUAcgBzAGkAbwBuAD0AIgA0AC4AMAAuADAALgAwACIAPgA8AEQAQQBUAEEAPgA8AFAAUgBPAFQARQBDAFQASQBOAEYATwA+ADwASwBFAFkATABFAE4APgAxADYAPAAvAEsARQBZAEwARQBOAD4APABBAEwARwBJAEQAPgBBAEUAUwBDAFQAUgA8AC8AQQBMAEcASQBEAD4APAAvAFAAUgBPAFQARQBDAFQASQBOAEYATwA+ADwASwBJAEQAPgBOAEQATQB5AE0AVABZADEATwBEAGMANQBNAEQARQB5AE0AegBRADEATgBnAD0APQA8AC8ASwBJAEQAPgA8AEMASABFAEMASwBTAFUATQA+AGwANQBMAG8AVQBnAEsAOQBLAEMAZwA9ADwALwBDAEgARQBDAEsAUwBVAE0APgA8AC8ARABBAFQAQQA+ADwALwBXAFIATQBIAEUAQQBEAEUAUgA+AA== @@ -16,28 +16,7 @@ urn:marlin:kid:31323334353637383930313233343536 - - bear-640x360-video.mp4 - - - - - - - - - AAACJnBzc2gAAAAAmgTweZhAQoarkuZb4IhflQAAAgYGAgAAAQABAPwBPABXAFIATQBIAEUAQQBEAEUAUgAgAHgAbQBsAG4AcwA9ACIAaAB0AHQAcAA6AC8ALwBzAGMAaABlAG0AYQBzAC4AbQBpAGMAcgBvAHMAbwBmAHQALgBjAG8AbQAvAEQAUgBNAC8AMgAwADAANwAvADAAMwAvAFAAbABhAHkAUgBlAGEAZAB5AEgAZQBhAGQAZQByACIAIAB2AGUAcgBzAGkAbwBuAD0AIgA0AC4AMAAuADAALgAwACIAPgA8AEQAQQBUAEEAPgA8AFAAUgBPAFQARQBDAFQASQBOAEYATwA+ADwASwBFAFkATABFAE4APgAxADYAPAAvAEsARQBZAEwARQBOAD4APABBAEwARwBJAEQAPgBBAEUAUwBDAFQAUgA8AC8AQQBMAEcASQBEAD4APAAvAFAAUgBPAFQARQBDAFQASQBOAEYATwA+ADwASwBJAEQAPgBOAEQATQB5AE0AVABZADEATwBEAGMANQBNAEQARQB5AE0AegBRADEATgBnAD0APQA8AC8ASwBJAEQAPgA8AEMASABFAEMASwBTAFUATQA+AGwANQBMAG8AVQBnAEsAOQBLAEMAZwA9ADwALwBDAEgARQBDAEsAUwBVAE0APgA8AC8ARABBAFQAQQA+ADwALwBXAFIATQBIAEUAQQBEAEUAUgA+AA== - BgIAAAEAAQD8ATwAVwBSAE0ASABFAEEARABFAFIAIAB4AG0AbABuAHMAPQAiAGgAdAB0AHAAOgAvAC8AcwBjAGgAZQBtAGEAcwAuAG0AaQBjAHIAbwBzAG8AZgB0AC4AYwBvAG0ALwBEAFIATQAvADIAMAAwADcALwAwADMALwBQAGwAYQB5AFIAZQBhAGQAeQBIAGUAYQBkAGUAcgAiACAAdgBlAHIAcwBpAG8AbgA9ACIANAAuADAALgAwAC4AMAAiAD4APABEAEEAVABBAD4APABQAFIATwBUAEUAQwBUAEkATgBGAE8APgA8AEsARQBZAEwARQBOAD4AMQA2ADwALwBLAEUAWQBMAEUATgA+ADwAQQBMAEcASQBEAD4AQQBFAFMAQwBUAFIAPAAvAEEATABHAEkARAA+ADwALwBQAFIATwBUAEUAQwBUAEkATgBGAE8APgA8AEsASQBEAD4ATgBEAE0AeQBNAFQAWQAxAE8ARABjADUATQBEAEUAeQBNAHoAUQAxAE4AZwA9AD0APAAvAEsASQBEAD4APABDAEgARQBDAEsAUwBVAE0APgBsADUATABvAFUAZwBLADkASwBDAGcAPQA8AC8AQwBIAEUAQwBLAFMAVQBNAD4APAAvAEQAQQBUAEEAPgA8AC8AVwBSAE0ASABFAEEARABFAFIAPgA= - - - AAAAOHBzc2gAAAAA7e+LqXnWSs6jyCfc1R0h7QAAABgSEDEyMzQ1Njc4OTAxMjM0NTZI49yVmwY= - - - - urn:marlin:kid:31323334353637383930313233343536 - - - + bear-640x360-audio.mp4 @@ -45,5 +24,26 @@ + + + + AAACJnBzc2gAAAAAmgTweZhAQoarkuZb4IhflQAAAgYGAgAAAQABAPwBPABXAFIATQBIAEUAQQBEAEUAUgAgAHgAbQBsAG4AcwA9ACIAaAB0AHQAcAA6AC8ALwBzAGMAaABlAG0AYQBzAC4AbQBpAGMAcgBvAHMAbwBmAHQALgBjAG8AbQAvAEQAUgBNAC8AMgAwADAANwAvADAAMwAvAFAAbABhAHkAUgBlAGEAZAB5AEgAZQBhAGQAZQByACIAIAB2AGUAcgBzAGkAbwBuAD0AIgA0AC4AMAAuADAALgAwACIAPgA8AEQAQQBUAEEAPgA8AFAAUgBPAFQARQBDAFQASQBOAEYATwA+ADwASwBFAFkATABFAE4APgAxADYAPAAvAEsARQBZAEwARQBOAD4APABBAEwARwBJAEQAPgBBAEUAUwBDAFQAUgA8AC8AQQBMAEcASQBEAD4APAAvAFAAUgBPAFQARQBDAFQASQBOAEYATwA+ADwASwBJAEQAPgBOAEQATQB5AE0AVABZADEATwBEAGMANQBNAEQARQB5AE0AegBRADEATgBnAD0APQA8AC8ASwBJAEQAPgA8AEMASABFAEMASwBTAFUATQA+AGwANQBMAG8AVQBnAEsAOQBLAEMAZwA9ADwALwBDAEgARQBDAEsAUwBVAE0APgA8AC8ARABBAFQAQQA+ADwALwBXAFIATQBIAEUAQQBEAEUAUgA+AA== + BgIAAAEAAQD8ATwAVwBSAE0ASABFAEEARABFAFIAIAB4AG0AbABuAHMAPQAiAGgAdAB0AHAAOgAvAC8AcwBjAGgAZQBtAGEAcwAuAG0AaQBjAHIAbwBzAG8AZgB0AC4AYwBvAG0ALwBEAFIATQAvADIAMAAwADcALwAwADMALwBQAGwAYQB5AFIAZQBhAGQAeQBIAGUAYQBkAGUAcgAiACAAdgBlAHIAcwBpAG8AbgA9ACIANAAuADAALgAwAC4AMAAiAD4APABEAEEAVABBAD4APABQAFIATwBUAEUAQwBUAEkATgBGAE8APgA8AEsARQBZAEwARQBOAD4AMQA2ADwALwBLAEUAWQBMAEUATgA+ADwAQQBMAEcASQBEAD4AQQBFAFMAQwBUAFIAPAAvAEEATABHAEkARAA+ADwALwBQAFIATwBUAEUAQwBUAEkATgBGAE8APgA8AEsASQBEAD4ATgBEAE0AeQBNAFQAWQAxAE8ARABjADUATQBEAEUAeQBNAHoAUQAxAE4AZwA9AD0APAAvAEsASQBEAD4APABDAEgARQBDAEsAUwBVAE0APgBsADUATABvAFUAZwBLADkASwBDAGcAPQA8AC8AQwBIAEUAQwBLAFMAVQBNAD4APAAvAEQAQQBUAEEAPgA8AC8AVwBSAE0ASABFAEEARABFAFIAPgA= + + + AAAAOHBzc2gAAAAA7e+LqXnWSs6jyCfc1R0h7QAAABgSEDEyMzQ1Njc4OTAxMjM0NTZI49yVmwY= + + + + urn:marlin:kid:31323334353637383930313233343536 + + + + bear-640x360-video.mp4 + + + + + diff --git a/packager/app/test/testdata/encryption/output.mpd b/packager/app/test/testdata/encryption/output.mpd index ffe39e9ffc..3d496a56ce 100644 --- a/packager/app/test/testdata/encryption/output.mpd +++ b/packager/app/test/testdata/encryption/output.mpd @@ -2,24 +2,12 @@ - + AAAANHBzc2gBAAAAEHfv7MCyTQKs4zweUuL7SwAAAAExMjM0NTY3ODkwMTIzNDU2AAAAAA== - - bear-640x360-video.mp4 - - - - - - - - - AAAANHBzc2gBAAAAEHfv7MCyTQKs4zweUuL7SwAAAAExMjM0NTY3ODkwMTIzNDU2AAAAAA== - - + bear-640x360-audio.mp4 @@ -27,5 +15,17 @@ + + + + AAAANHBzc2gBAAAAEHfv7MCyTQKs4zweUuL7SwAAAAExMjM0NTY3ODkwMTIzNDU2AAAAAA== + + + bear-640x360-video.mp4 + + + + + diff --git a/packager/app/test/testdata/forced-commandline-ordering/bear-1280x720-video.mp4 b/packager/app/test/testdata/forced-commandline-ordering/bear-1280x720-video.mp4 new file mode 100644 index 0000000000..eb0e007054 Binary files /dev/null and b/packager/app/test/testdata/forced-commandline-ordering/bear-1280x720-video.mp4 differ diff --git a/packager/app/test/testdata/forced-commandline-ordering/bear-640x360-audio.mp4 b/packager/app/test/testdata/forced-commandline-ordering/bear-640x360-audio.mp4 new file mode 100644 index 0000000000..10077f9af8 Binary files /dev/null and b/packager/app/test/testdata/forced-commandline-ordering/bear-640x360-audio.mp4 differ diff --git a/packager/app/test/testdata/forced-commandline-ordering/bear-640x360-hevc-video.mp4 b/packager/app/test/testdata/forced-commandline-ordering/bear-640x360-hevc-video.mp4 new file mode 100644 index 0000000000..9efb29c9f2 Binary files /dev/null and b/packager/app/test/testdata/forced-commandline-ordering/bear-640x360-hevc-video.mp4 differ diff --git a/packager/app/test/testdata/forced-commandline-ordering/bear-640x360-video.mp4 b/packager/app/test/testdata/forced-commandline-ordering/bear-640x360-video.mp4 new file mode 100644 index 0000000000..de83807979 Binary files /dev/null and b/packager/app/test/testdata/forced-commandline-ordering/bear-640x360-video.mp4 differ diff --git a/packager/app/test/testdata/forced-commandline-ordering/bear-english-text.vtt b/packager/app/test/testdata/forced-commandline-ordering/bear-english-text.vtt new file mode 100644 index 0000000000..18ae752fe8 --- /dev/null +++ b/packager/app/test/testdata/forced-commandline-ordering/bear-english-text.vtt @@ -0,0 +1,11 @@ +WEBVTT + +STYLE +::cue { color:lime } + +00:00:00.000 --> 00:00:00.800 align:center +Yup, that's a bear, eh. + +00:00:01.000 --> 00:00:04.700 align:center +He 's... um... doing bear-like stuff. + diff --git a/packager/app/test/testdata/forced-commandline-ordering/output.m3u8 b/packager/app/test/testdata/forced-commandline-ordering/output.m3u8 new file mode 100644 index 0000000000..43698a91dd --- /dev/null +++ b/packager/app/test/testdata/forced-commandline-ordering/output.m3u8 @@ -0,0 +1,15 @@ +#EXTM3U +## Generated with https://github.com/shaka-project/shaka-packager version -- + +#EXT-X-INDEPENDENT-SEGMENTS + +#EXT-X-MEDIA:TYPE=AUDIO,URI="stream_2.m3u8",GROUP-ID="default-audio-group",NAME="stream_2",DEFAULT=NO,AUTOSELECT=YES,CHANNELS="2" + +#EXT-X-MEDIA:TYPE=SUBTITLES,URI="stream_4.m3u8",GROUP-ID="default-text-group",NAME="stream_4",DEFAULT=NO,AUTOSELECT=YES + +#EXT-X-STREAM-INF:BANDWIDTH=410745,AVERAGE-BANDWIDTH=378029,CODECS="hvc1.1.6.L63.90,mp4a.40.2",RESOLUTION=640x360,FRAME-RATE=29.970,AUDIO="default-audio-group",SUBTITLES="default-text-group",CLOSED-CAPTIONS=NONE +stream_1.m3u8 +#EXT-X-STREAM-INF:BANDWIDTH=2760619,AVERAGE-BANDWIDTH=2511928,CODECS="avc1.64001f,mp4a.40.2",RESOLUTION=1280x720,FRAME-RATE=29.970,AUDIO="default-audio-group",SUBTITLES="default-text-group",CLOSED-CAPTIONS=NONE +stream_0.m3u8 +#EXT-X-STREAM-INF:BANDWIDTH=1106817,AVERAGE-BANDWIDTH=1004632,CODECS="avc1.64001e,mp4a.40.2",RESOLUTION=640x360,FRAME-RATE=29.970,AUDIO="default-audio-group",SUBTITLES="default-text-group",CLOSED-CAPTIONS=NONE +stream_3.m3u8 diff --git a/packager/app/test/testdata/forced-commandline-ordering/output.mpd b/packager/app/test/testdata/forced-commandline-ordering/output.mpd new file mode 100644 index 0000000000..c6f9030b45 --- /dev/null +++ b/packager/app/test/testdata/forced-commandline-ordering/output.mpd @@ -0,0 +1,43 @@ + + + + + + + + bear-english-text.vtt + + + + + + bear-640x360-audio.mp4 + + + + + + + + bear-640x360-hevc-video.mp4 + + + + + + + + bear-1280x720-video.mp4 + + + + + + bear-640x360-video.mp4 + + + + + + + diff --git a/packager/app/test/testdata/forced-commandline-ordering/stream_0.m3u8 b/packager/app/test/testdata/forced-commandline-ordering/stream_0.m3u8 new file mode 100644 index 0000000000..c3b150ffa2 --- /dev/null +++ b/packager/app/test/testdata/forced-commandline-ordering/stream_0.m3u8 @@ -0,0 +1,16 @@ +#EXTM3U +#EXT-X-VERSION:6 +## Generated with https://github.com/shaka-project/shaka-packager version -- +#EXT-X-TARGETDURATION:5 +#EXT-X-PLAYLIST-TYPE:VOD +#EXT-X-MAP:URI="bear-1280x720-video.mp4",BYTERANGE="869@0" +#EXTINF:1.001, +#EXT-X-BYTERANGE:267311@937 +bear-1280x720-video.mp4 +#EXTINF:1.001, +#EXT-X-BYTERANGE:328739 +bear-1280x720-video.mp4 +#EXTINF:0.734, +#EXT-X-BYTERANGE:220240 +bear-1280x720-video.mp4 +#EXT-X-ENDLIST diff --git a/packager/app/test/testdata/forced-commandline-ordering/stream_1.m3u8 b/packager/app/test/testdata/forced-commandline-ordering/stream_1.m3u8 new file mode 100644 index 0000000000..ba80330446 --- /dev/null +++ b/packager/app/test/testdata/forced-commandline-ordering/stream_1.m3u8 @@ -0,0 +1,16 @@ +#EXTM3U +#EXT-X-VERSION:6 +## Generated with https://github.com/shaka-project/shaka-packager version -- +#EXT-X-TARGETDURATION:5 +#EXT-X-PLAYLIST-TYPE:VOD +#EXT-X-MAP:URI="bear-640x360-hevc-video.mp4",BYTERANGE="1910@0" +#EXTINF:1.001, +#EXT-X-BYTERANGE:26885@1978 +bear-640x360-hevc-video.mp4 +#EXTINF:1.001, +#EXT-X-BYTERANGE:34711 +bear-640x360-hevc-video.mp4 +#EXTINF:0.801, +#EXT-X-BYTERANGE:26992 +bear-640x360-hevc-video.mp4 +#EXT-X-ENDLIST diff --git a/packager/app/test/testdata/forced-commandline-ordering/stream_2.m3u8 b/packager/app/test/testdata/forced-commandline-ordering/stream_2.m3u8 new file mode 100644 index 0000000000..4722e68aa9 --- /dev/null +++ b/packager/app/test/testdata/forced-commandline-ordering/stream_2.m3u8 @@ -0,0 +1,16 @@ +#EXTM3U +#EXT-X-VERSION:6 +## Generated with https://github.com/shaka-project/shaka-packager version -- +#EXT-X-TARGETDURATION:5 +#EXT-X-PLAYLIST-TYPE:VOD +#EXT-X-MAP:URI="bear-640x360-audio.mp4",BYTERANGE="804@0" +#EXTINF:1.022, +#EXT-X-BYTERANGE:17028@872 +bear-640x360-audio.mp4 +#EXTINF:0.998, +#EXT-X-BYTERANGE:16285 +bear-640x360-audio.mp4 +#EXTINF:0.720, +#EXT-X-BYTERANGE:9558 +bear-640x360-audio.mp4 +#EXT-X-ENDLIST diff --git a/packager/app/test/testdata/forced-commandline-ordering/stream_3.m3u8 b/packager/app/test/testdata/forced-commandline-ordering/stream_3.m3u8 new file mode 100644 index 0000000000..b687af701e --- /dev/null +++ b/packager/app/test/testdata/forced-commandline-ordering/stream_3.m3u8 @@ -0,0 +1,16 @@ +#EXTM3U +#EXT-X-VERSION:6 +## Generated with https://github.com/shaka-project/shaka-packager version -- +#EXT-X-TARGETDURATION:5 +#EXT-X-PLAYLIST-TYPE:VOD +#EXT-X-MAP:URI="bear-640x360-video.mp4",BYTERANGE="870@0" +#EXTINF:1.001, +#EXT-X-BYTERANGE:99313@938 +bear-640x360-video.mp4 +#EXTINF:1.001, +#EXT-X-BYTERANGE:121807 +bear-640x360-video.mp4 +#EXTINF:0.734, +#EXT-X-BYTERANGE:79662 +bear-640x360-video.mp4 +#EXT-X-ENDLIST diff --git a/packager/app/test/testdata/forced-commandline-ordering/stream_4.m3u8 b/packager/app/test/testdata/forced-commandline-ordering/stream_4.m3u8 new file mode 100644 index 0000000000..1ed204e274 --- /dev/null +++ b/packager/app/test/testdata/forced-commandline-ordering/stream_4.m3u8 @@ -0,0 +1,8 @@ +#EXTM3U +#EXT-X-VERSION:6 +## Generated with https://github.com/shaka-project/shaka-packager version -- +#EXT-X-TARGETDURATION:5 +#EXT-X-PLAYLIST-TYPE:VOD +#EXTINF:4.700, +bear-english-text.vtt +#EXT-X-ENDLIST diff --git a/packager/app/test/testdata/hls-only-dash-only-captions/output.mpd b/packager/app/test/testdata/hls-only-dash-only-captions/output.mpd index 03a5990310..6b5413197d 100644 --- a/packager/app/test/testdata/hls-only-dash-only-captions/output.mpd +++ b/packager/app/test/testdata/hls-only-dash-only-captions/output.mpd @@ -2,18 +2,8 @@ - - - - - - - - - - - - + + @@ -24,6 +14,16 @@ + + + + + + + + + + diff --git a/packager/app/test/testdata/hls-only-dash-only/output.mpd b/packager/app/test/testdata/hls-only-dash-only/output.mpd index 0c973fc5cd..038d88a0cf 100644 --- a/packager/app/test/testdata/hls-only-dash-only/output.mpd +++ b/packager/app/test/testdata/hls-only-dash-only/output.mpd @@ -3,7 +3,7 @@ - + bear-640x360-audio.mp4 diff --git a/packager/app/test/testdata/live-profile-and-encryption-and-mult-files/output.mpd b/packager/app/test/testdata/live-profile-and-encryption-and-mult-files/output.mpd index b2fd725df9..c5f284b6df 100644 --- a/packager/app/test/testdata/live-profile-and-encryption-and-mult-files/output.mpd +++ b/packager/app/test/testdata/live-profile-and-encryption-and-mult-files/output.mpd @@ -2,42 +2,12 @@ - + AAAANHBzc2gBAAAAEHfv7MCyTQKs4zweUuL7SwAAAAExMjM0NTY3ODkwMTIzNDU2AAAAAA== - - - - - - - - - - - - - - - - - - - - - - - - - - - - - AAAANHBzc2gBAAAAEHfv7MCyTQKs4zweUuL7SwAAAAExMjM0NTY3ODkwMTIzNDU2AAAAAA== - - + @@ -47,17 +17,7 @@ - - - - - - - - - - - + @@ -67,6 +27,46 @@ + + + + + + + + + + + + + + + AAAANHBzc2gBAAAAEHfv7MCyTQKs4zweUuL7SwAAAAExMjM0NTY3ODkwMTIzNDU2AAAAAA== + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/packager/app/test/testdata/live-profile-and-encryption-and-non-dash-if-iop/output.mpd b/packager/app/test/testdata/live-profile-and-encryption-and-non-dash-if-iop/output.mpd index 121193085c..d62981b56a 100644 --- a/packager/app/test/testdata/live-profile-and-encryption-and-non-dash-if-iop/output.mpd +++ b/packager/app/test/testdata/live-profile-and-encryption-and-non-dash-if-iop/output.mpd @@ -2,22 +2,8 @@ - - - - - AAAANHBzc2gBAAAAEHfv7MCyTQKs4zweUuL7SwAAAAExMjM0NTY3ODkwMTIzNDU2AAAAAA== - - - - - - - - - - - + + @@ -32,5 +18,19 @@ + + + + + AAAANHBzc2gBAAAAEHfv7MCyTQKs4zweUuL7SwAAAAExMjM0NTY3ODkwMTIzNDU2AAAAAA== + + + + + + + + + diff --git a/packager/app/test/testdata/live-profile-and-encryption/output.mpd b/packager/app/test/testdata/live-profile-and-encryption/output.mpd index b660ce33d6..81b06c5f32 100644 --- a/packager/app/test/testdata/live-profile-and-encryption/output.mpd +++ b/packager/app/test/testdata/live-profile-and-encryption/output.mpd @@ -2,26 +2,12 @@ - + AAAANHBzc2gBAAAAEHfv7MCyTQKs4zweUuL7SwAAAAExMjM0NTY3ODkwMTIzNDU2AAAAAA== - - - - - - - - - - - - - AAAANHBzc2gBAAAAEHfv7MCyTQKs4zweUuL7SwAAAAExMjM0NTY3ODkwMTIzNDU2AAAAAA== - - + @@ -32,5 +18,19 @@ + + + + AAAANHBzc2gBAAAAEHfv7MCyTQKs4zweUuL7SwAAAAExMjM0NTY3ODkwMTIzNDU2AAAAAA== + + + + + + + + + + diff --git a/packager/app/test/testdata/live-profile-and-key-rotation-and-no-pssh-in-stream/output.mpd b/packager/app/test/testdata/live-profile-and-key-rotation-and-no-pssh-in-stream/output.mpd index 9ebc81dfe1..4befe541d3 100644 --- a/packager/app/test/testdata/live-profile-and-key-rotation-and-no-pssh-in-stream/output.mpd +++ b/packager/app/test/testdata/live-profile-and-key-rotation-and-no-pssh-in-stream/output.mpd @@ -2,22 +2,10 @@ - + - - - - - - - - - - - - - + @@ -28,5 +16,17 @@ + + + + + + + + + + + + diff --git a/packager/app/test/testdata/live-profile-and-key-rotation-and-non-dash-if-iop/output.mpd b/packager/app/test/testdata/live-profile-and-key-rotation-and-non-dash-if-iop/output.mpd index 77ba7447ea..4a27746c50 100644 --- a/packager/app/test/testdata/live-profile-and-key-rotation-and-non-dash-if-iop/output.mpd +++ b/packager/app/test/testdata/live-profile-and-key-rotation-and-non-dash-if-iop/output.mpd @@ -2,20 +2,8 @@ - - - - - - - - - - - - - - + + @@ -28,5 +16,17 @@ + + + + + + + + + + + + diff --git a/packager/app/test/testdata/live-profile-and-key-rotation-cbcs/output.mpd b/packager/app/test/testdata/live-profile-and-key-rotation-cbcs/output.mpd index 4b51a0e35f..5f7ae9bdfd 100644 --- a/packager/app/test/testdata/live-profile-and-key-rotation-cbcs/output.mpd +++ b/packager/app/test/testdata/live-profile-and-key-rotation-cbcs/output.mpd @@ -2,22 +2,10 @@ - + - - - - - - - - - - - - - + @@ -28,5 +16,17 @@ + + + + + + + + + + + + diff --git a/packager/app/test/testdata/live-profile-and-key-rotation/output.mpd b/packager/app/test/testdata/live-profile-and-key-rotation/output.mpd index 861518a1f7..02fb8c83f5 100644 --- a/packager/app/test/testdata/live-profile-and-key-rotation/output.mpd +++ b/packager/app/test/testdata/live-profile-and-key-rotation/output.mpd @@ -2,22 +2,10 @@ - + - - - - - - - - - - - - - + @@ -28,5 +16,17 @@ + + + + + + + + + + + + diff --git a/packager/app/test/testdata/live-profile/output.mpd b/packager/app/test/testdata/live-profile/output.mpd index 8f3cbde818..03bf36387f 100644 --- a/packager/app/test/testdata/live-profile/output.mpd +++ b/packager/app/test/testdata/live-profile/output.mpd @@ -2,18 +2,8 @@ - - - - - - - - - - - - + + @@ -24,6 +14,16 @@ + + + + + + + + + + diff --git a/packager/app/test/testdata/live-static-profile-with-time-in-segment-name/output.mpd b/packager/app/test/testdata/live-static-profile-with-time-in-segment-name/output.mpd index 24fb0aa570..8d0ce66cf8 100644 --- a/packager/app/test/testdata/live-static-profile-with-time-in-segment-name/output.mpd +++ b/packager/app/test/testdata/live-static-profile-with-time-in-segment-name/output.mpd @@ -2,18 +2,8 @@ - - - - - - - - - - - - + + @@ -24,5 +14,15 @@ + + + + + + + + + + diff --git a/packager/app/test/testdata/live-static-profile/output.mpd b/packager/app/test/testdata/live-static-profile/output.mpd index e5ec245692..2224ac20fe 100644 --- a/packager/app/test/testdata/live-static-profile/output.mpd +++ b/packager/app/test/testdata/live-static-profile/output.mpd @@ -2,18 +2,8 @@ - - - - - - - - - - - - + + @@ -24,5 +14,15 @@ + + + + + + + + + + diff --git a/packager/app/test/testdata/mp4-trailing-moov/output.mpd b/packager/app/test/testdata/mp4-trailing-moov/output.mpd index 9ef5828eb7..83b418247f 100644 --- a/packager/app/test/testdata/mp4-trailing-moov/output.mpd +++ b/packager/app/test/testdata/mp4-trailing-moov/output.mpd @@ -2,16 +2,8 @@ - - - bear-640x360-trailing-moov-video.mp4 - - - - - - - + + bear-640x360-trailing-moov-audio.mp4 @@ -19,5 +11,13 @@ + + + bear-640x360-trailing-moov-video.mp4 + + + + + diff --git a/packager/app/test/testdata/video-audio-ttml/output.mpd b/packager/app/test/testdata/video-audio-ttml/output.mpd index 69cc78f0bf..e1ef315e3e 100644 --- a/packager/app/test/testdata/video-audio-ttml/output.mpd +++ b/packager/app/test/testdata/video-audio-ttml/output.mpd @@ -7,16 +7,8 @@ bear-english-text.ttml - - - bear-640x360-video.mp4 - - - - - - - + + bear-640x360-audio.mp4 @@ -24,5 +16,13 @@ + + + bear-640x360-video.mp4 + + + + + diff --git a/packager/app/test/testdata/video-audio-webvtt/output.mpd b/packager/app/test/testdata/video-audio-webvtt/output.mpd index 5e4e62b993..b128b524e1 100644 --- a/packager/app/test/testdata/video-audio-webvtt/output.mpd +++ b/packager/app/test/testdata/video-audio-webvtt/output.mpd @@ -2,16 +2,8 @@ - - - bear-640x360-video.mp4 - - - - - - - + + bear-640x360-audio.mp4 @@ -19,6 +11,14 @@ + + + bear-640x360-video.mp4 + + + + + diff --git a/packager/app/test/testdata/vtt-text-to-mp4-with-ad-cues/output.mpd b/packager/app/test/testdata/vtt-text-to-mp4-with-ad-cues/output.mpd index 53fa960019..31b4ab7a99 100644 --- a/packager/app/test/testdata/vtt-text-to-mp4-with-ad-cues/output.mpd +++ b/packager/app/test/testdata/vtt-text-to-mp4-with-ad-cues/output.mpd @@ -2,17 +2,8 @@ - - - - - - - - - - - + + @@ -22,6 +13,15 @@ + + + + + + + + + @@ -35,17 +35,8 @@ - - - - - - - - - - - + + @@ -54,6 +45,15 @@ + + + + + + + + + diff --git a/packager/hls/base/master_playlist.cc b/packager/hls/base/master_playlist.cc index 752207baaa..e6f8f650b2 100644 --- a/packager/hls/base/master_playlist.cc +++ b/packager/hls/base/master_playlist.cc @@ -360,7 +360,7 @@ void BuildMediaTag(const MediaPlaylist& playlist, } void BuildMediaTags( - const std::map>& groups, + std::list>>& groups, const std::string& default_language, const std::string& base_url, std::string* out) { @@ -407,6 +407,18 @@ void BuildMediaTags( } } +bool ListOrderFn(const MediaPlaylist*& a, const MediaPlaylist*& b) { + return a->GetMediaInfo().index() < b->GetMediaInfo().index(); +} + +bool GroupOrderFn(std::pair>& a, + std::pair>& b) { + a.second.sort(ListOrderFn); + b.second.sort(ListOrderFn); + return a.second.front()->GetMediaInfo().index() < + b.second.front()->GetMediaInfo().index(); +} + void AppendPlaylists(const std::string& default_audio_language, const std::string& default_text_language, const std::string& base_url, @@ -417,7 +429,12 @@ void AppendPlaylists(const std::string& default_audio_language, subtitle_playlist_groups; std::list video_playlists; std::list iframe_playlists; + + bool has_index = true; + for (const MediaPlaylist* playlist : playlists) { + has_index = has_index && playlist->GetMediaInfo().has_index(); + switch (playlist->stream_type()) { case MediaPlaylist::MediaPlaylistStreamType::kAudio: audio_playlist_groups[GetGroupId(*playlist)].push_back(playlist); @@ -437,15 +454,37 @@ void AppendPlaylists(const std::string& default_audio_language, } } + // convert the std::map to std::list and reorder it if indexes were provided + std::list>> + audio_groups_list(audio_playlist_groups.begin(), + audio_playlist_groups.end()); + std::list>> + subtitle_groups_list(subtitle_playlist_groups.begin(), + subtitle_playlist_groups.end()); + if (has_index) { + audio_groups_list.sort(GroupOrderFn); + for (const auto& group : audio_groups_list) { + std::list group_playlists = group.second; + group_playlists.sort(ListOrderFn); + } + subtitle_groups_list.sort(GroupOrderFn); + for (const auto& group : subtitle_groups_list) { + std::list group_playlists = group.second; + group_playlists.sort(ListOrderFn); + } + video_playlists.sort(ListOrderFn); + iframe_playlists.sort(ListOrderFn); + } + if (!audio_playlist_groups.empty()) { content->append("\n"); - BuildMediaTags(audio_playlist_groups, default_audio_language, base_url, + BuildMediaTags(audio_groups_list, default_audio_language, base_url, content); } if (!subtitle_playlist_groups.empty()) { content->append("\n"); - BuildMediaTags(subtitle_playlist_groups, default_text_language, base_url, + BuildMediaTags(subtitle_groups_list, default_text_language, base_url, content); } @@ -472,7 +511,7 @@ void AppendPlaylists(const std::string& default_audio_language, if (!audio_playlist_groups.empty() && video_playlists.empty() && subtitle_playlist_groups.empty()) { content->append("\n"); - for (const auto& playlist_group : audio_playlist_groups) { + for (const auto& playlist_group : audio_groups_list) { Variant variant; // Populate |audio_group_id|, which will be propagated to "AUDIO" field. // Leaving other fields, e.g. xxx_audio_bitrate in |Variant|, as diff --git a/packager/hls/base/master_playlist_unittest.cc b/packager/hls/base/master_playlist_unittest.cc index 887e5e4fe7..4294e05259 100644 --- a/packager/hls/base/master_playlist_unittest.cc +++ b/packager/hls/base/master_playlist_unittest.cc @@ -187,11 +187,9 @@ TEST_F(MasterPlaylistTest, const uint64_t kMaxBitrate = 435889; const uint64_t kAvgBitrate = 235889; - master_playlist_.reset(new MasterPlaylist( - kDefaultMasterPlaylistName, - kDefaultAudioLanguage, - kDefaultTextLanguage, - kIsIndependentSegments)); + master_playlist_.reset( + new MasterPlaylist(kDefaultMasterPlaylistName, kDefaultAudioLanguage, + kDefaultTextLanguage, kIsIndependentSegments)); std::unique_ptr mock_playlist = CreateVideoPlaylist("media1.m3u8", "avc1", kMaxBitrate, kAvgBitrate); diff --git a/packager/hls/base/media_playlist.h b/packager/hls/base/media_playlist.h index a97f251e86..ac64efe9b9 100644 --- a/packager/hls/base/media_playlist.h +++ b/packager/hls/base/media_playlist.h @@ -99,6 +99,7 @@ class MediaPlaylist { /// to this playlist. /// @return true on success, false otherwise. virtual bool SetMediaInfo(const MediaInfo& media_info); + MediaInfo GetMediaInfo() const { return media_info_; } /// Set the sample duration. Sample duration is used to generate frame rate. /// Sample duration is not available right away especially. This allows diff --git a/packager/media/event/hls_notify_muxer_listener.cc b/packager/media/event/hls_notify_muxer_listener.cc index 316a46293d..e7bcc49edf 100644 --- a/packager/media/event/hls_notify_muxer_listener.cc +++ b/packager/media/event/hls_notify_muxer_listener.cc @@ -26,13 +26,15 @@ HlsNotifyMuxerListener::HlsNotifyMuxerListener( const std::string& ext_x_media_name, const std::string& ext_x_media_group_id, const std::vector& characteristics, - hls::HlsNotifier* hls_notifier) + hls::HlsNotifier* hls_notifier, + std::optional index) : playlist_name_(playlist_name), iframes_only_(iframes_only), ext_x_media_name_(ext_x_media_name), ext_x_media_group_id_(ext_x_media_group_id), characteristics_(characteristics), - hls_notifier_(hls_notifier) { + hls_notifier_(hls_notifier), + index_(index) { DCHECK(hls_notifier); } @@ -101,6 +103,9 @@ void HlsNotifyMuxerListener::OnMediaStart(const MuxerOptions& muxer_options, for (const std::string& characteristic : characteristics_) media_info->add_hls_characteristics(characteristic); } + if (index_.has_value()) + media_info->set_index(index_.value()); + if (protection_scheme_ != FOURCC_NULL) { internal::SetContentProtectionFields(protection_scheme_, next_key_id_, next_key_system_infos_, diff --git a/packager/media/event/hls_notify_muxer_listener.h b/packager/media/event/hls_notify_muxer_listener.h index a1e2f6e330..3aa0f3151f 100644 --- a/packager/media/event/hls_notify_muxer_listener.h +++ b/packager/media/event/hls_notify_muxer_listener.h @@ -45,7 +45,8 @@ class HlsNotifyMuxerListener : public MuxerListener { const std::string& ext_x_media_name, const std::string& ext_x_media_group_id, const std::vector& characteristics, - hls::HlsNotifier* hls_notifier); + hls::HlsNotifier* hls_notifier, + std::optional index); ~HlsNotifyMuxerListener() override; /// @name MuxerListener implementation overrides. @@ -87,6 +88,7 @@ class HlsNotifyMuxerListener : public MuxerListener { const std::vector characteristics_; hls::HlsNotifier* const hls_notifier_; std::optional stream_id_; + std::optional index_; bool must_notify_encryption_start_ = false; // Cached encryption info before OnMediaStart() is called. diff --git a/packager/media/event/hls_notify_muxer_listener_unittest.cc b/packager/media/event/hls_notify_muxer_listener_unittest.cc index 863095434f..9c1f4296c2 100644 --- a/packager/media/event/hls_notify_muxer_listener_unittest.cc +++ b/packager/media/event/hls_notify_muxer_listener_unittest.cc @@ -121,7 +121,8 @@ class HlsNotifyMuxerListenerTest : public ::testing::Test { kDefaultName, kDefaultGroupId, std::vector{kCharactersticA, kCharactersticB}, - &mock_notifier_) {} + &mock_notifier_, + 0) {} MuxerListener::MediaRanges GetMediaRanges( const std::vector& segment_ranges) { @@ -458,7 +459,8 @@ class HlsNotifyMuxerListenerKeyFrameTest : public TestWithParam { kDefaultName, kDefaultGroupId, std::vector(), // no characteristics. - &mock_notifier_) {} + &mock_notifier_, + 0) {} MockHlsNotifier mock_notifier_; HlsNotifyMuxerListener listener_; diff --git a/packager/media/event/mpd_notify_muxer_listener.cc b/packager/media/event/mpd_notify_muxer_listener.cc index 903c2c12d7..ee44adf126 100644 --- a/packager/media/event/mpd_notify_muxer_listener.cc +++ b/packager/media/event/mpd_notify_muxer_listener.cc @@ -85,6 +85,9 @@ void MpdNotifyMuxerListener::OnMediaStart(const MuxerOptions& muxer_options, media_info->add_dash_roles(role); } + if (index_.has_value()) + media_info->set_index(index_.value()); + if (is_encrypted_) { internal::SetContentProtectionFields(protection_scheme_, default_key_id_, key_system_info_, media_info.get()); diff --git a/packager/media/event/mpd_notify_muxer_listener.h b/packager/media/event/mpd_notify_muxer_listener.h index 8e5aef5774..a371ca8772 100644 --- a/packager/media/event/mpd_notify_muxer_listener.h +++ b/packager/media/event/mpd_notify_muxer_listener.h @@ -67,6 +67,8 @@ class MpdNotifyMuxerListener : public MuxerListener { void set_roles(const std::vector& roles) { roles_ = roles; } + void set_index(std::optional idx) { index_ = idx; } + private: MpdNotifyMuxerListener(const MpdNotifyMuxerListener&) = delete; MpdNotifyMuxerListener& operator=(const MpdNotifyMuxerListener&) = delete; @@ -80,6 +82,8 @@ class MpdNotifyMuxerListener : public MuxerListener { std::vector accessibilities_; std::vector roles_; + std::optional index_ = 0; + bool is_encrypted_ = false; // Storage for values passed to OnEncryptionInfoReady(). FourCC protection_scheme_ = FOURCC_NULL; diff --git a/packager/media/event/mpd_notify_muxer_listener_unittest.cc b/packager/media/event/mpd_notify_muxer_listener_unittest.cc index e20463a273..0cf6c3e10c 100644 --- a/packager/media/event/mpd_notify_muxer_listener_unittest.cc +++ b/packager/media/event/mpd_notify_muxer_listener_unittest.cc @@ -313,7 +313,8 @@ TEST_F(MpdNotifyMuxerListenerTest, VodOnSampleDurationReady) { "reference_time_scale: 1111\n" "container_type: 1\n" "media_file_name: 'test_output_file_name.mp4'\n" - "media_duration_seconds: 10.5\n"; + "media_duration_seconds: 10.5\n" + "index: 0\n"; const int32_t kReferenceTimeScale = 1111; // Should match the protobuf. @@ -361,6 +362,7 @@ TEST_F(MpdNotifyMuxerListenerTest, VodOnSampleDurationReadySegmentList) { "container_type: 1\n" "media_file_name: 'test_output_file_name.mp4'\n" "media_duration_seconds: 10.5\n" + "index: 0\n" "subsegment_ranges {\n" " begin: 222\n" " end: 9999\n" @@ -600,6 +602,7 @@ TEST_F(MpdNotifyMuxerListenerTest, LowLatencyDash) { " pixel_height: 1\n" "}\n" "media_duration_seconds: 20.0\n" + "index: 0\n" "init_segment_name: \"liveinit.mp4\"\n" "segment_template: \"live-$NUMBER$.mp4\"\n" "reference_time_scale: 1000\n" @@ -661,6 +664,7 @@ TEST_P(MpdNotifyMuxerListenerTest, LiveNoKeyRotation) { " pixel_height: 1\n" "}\n" "media_duration_seconds: 20.0\n" + "index: 0\n" "init_segment_name: \"liveinit.mp4\"\n" "segment_template: \"live-$NUMBER$.mp4\"\n" "reference_time_scale: 1000\n" @@ -669,7 +673,9 @@ TEST_P(MpdNotifyMuxerListenerTest, LiveNoKeyRotation) { " default_key_id: \"defaultkeyid\"\n" " content_protection_entry {\n" " uuid: '00010203-0405-0607-0809-0a0b0c0d0e0f'\n" - " pssh: \"" + std::string(kExpectedDefaultPsshBox) + "\"\n" + " pssh: \"" + + std::string(kExpectedDefaultPsshBox) + + "\"\n" " }\n" " protection_scheme: 'cbcs'\n" " include_mspr_pro: 1\n" @@ -738,6 +744,7 @@ TEST_P(MpdNotifyMuxerListenerTest, LiveWithKeyRotation) { " pixel_height: 1\n" "}\n" "media_duration_seconds: 20.0\n" + "index: 0\n" "init_segment_name: \"liveinit.mp4\"\n" "segment_template: \"live-$NUMBER$.mp4\"\n" "reference_time_scale: 1000\n" diff --git a/packager/media/event/muxer_listener_factory.cc b/packager/media/event/muxer_listener_factory.cc index ea63fdc353..e91be91993 100644 --- a/packager/media/event/muxer_listener_factory.cc +++ b/packager/media/event/muxer_listener_factory.cc @@ -44,6 +44,7 @@ std::unique_ptr CreateMpdListenerInternal( auto listener = std::make_unique(notifier); listener->set_accessibilities(stream.dash_accessiblities); listener->set_roles(stream.dash_roles); + listener->set_index(stream.index); return listener; } @@ -71,12 +72,13 @@ std::list> CreateHlsListenersInternal( const bool kIFramesOnly = true; std::list> listeners; - listeners.emplace_back(new HlsNotifyMuxerListener( - playlist_name, !kIFramesOnly, name, group_id, characteristics, notifier)); + listeners.emplace_back( + new HlsNotifyMuxerListener(playlist_name, !kIFramesOnly, name, group_id, + characteristics, notifier, stream.index)); if (!iframe_playlist_name.empty()) { listeners.emplace_back(new HlsNotifyMuxerListener( iframe_playlist_name, kIFramesOnly, name, group_id, - std::vector(), notifier)); + std::vector(), notifier, stream.index)); } return listeners; } diff --git a/packager/media/event/muxer_listener_factory.h b/packager/media/event/muxer_listener_factory.h index ffebf8080b..e5a3e7c096 100644 --- a/packager/media/event/muxer_listener_factory.h +++ b/packager/media/event/muxer_listener_factory.h @@ -8,6 +8,7 @@ #define PACKAGER_MEDIA_EVENT_MUXER_LISTENER_FACTORY_H_ #include +#include #include #include @@ -53,6 +54,7 @@ class MuxerListenerFactory { std::vector dash_accessiblities; std::vector dash_roles; bool dash_only = false; + std::optional index; }; /// Create a new muxer listener. diff --git a/packager/media/event/muxer_listener_test_helper.h b/packager/media/event/muxer_listener_test_helper.h index de20a8cfef..7affc5c44b 100644 --- a/packager/media/event/muxer_listener_test_helper.h +++ b/packager/media/event/muxer_listener_test_helper.h @@ -42,7 +42,8 @@ const char kExpectedDefaultMediaInfo[] = "reference_time_scale: 1000\n" "container_type: 1\n" "media_file_name: 'test_output_file_name.mp4'\n" - "media_duration_seconds: 10.5\n"; + "media_duration_seconds: 10.5\n" + "index: 0\n"; const char kExpectedDefaultMediaInfoSubsegmentRange[] = "video_info {\n" @@ -65,6 +66,7 @@ const char kExpectedDefaultMediaInfoSubsegmentRange[] = "container_type: 1\n" "media_file_name: 'test_output_file_name.mp4'\n" "media_duration_seconds: 10.5\n" + "index: 0\n" "subsegment_ranges {\n" " begin: 222\n" " end: 9999\n" diff --git a/packager/mpd/base/adaptation_set.cc b/packager/mpd/base/adaptation_set.cc index 36229a897f..2a16bfe85e 100644 --- a/packager/mpd/base/adaptation_set.cc +++ b/packager/mpd/base/adaptation_set.cc @@ -184,7 +184,10 @@ AdaptationSet::AdaptationSet(const std::string& language, AdaptationSet::~AdaptationSet() {} Representation* AdaptationSet::AddRepresentation(const MediaInfo& media_info) { - const uint32_t representation_id = (*representation_counter_)++; + const uint32_t representation_id = media_info.has_index() + ? media_info.index() + : (*representation_counter_)++; + // Note that AdaptationSet outlive Representation, so this object // will die before AdaptationSet. std::unique_ptr listener( @@ -251,6 +254,8 @@ std::optional AdaptationSet::GetXml() { bool suppress_representation_height = false; bool suppress_representation_frame_rate = false; + if (index_.has_value()) + id_ = index_.value(); if (id_ && !adaptation_set.SetId(id_.value())) return std::nullopt; if (!adaptation_set.SetStringAttribute("contentType", content_type_)) @@ -336,7 +341,10 @@ std::optional AdaptationSet::GetXml() { if (!trick_play_reference_ids.empty()) trick_play_reference_ids += ' '; CHECK(tp_adaptation_set->has_id()); - trick_play_reference_ids += std::to_string(tp_adaptation_set->id()); + trick_play_reference_ids += + std::to_string(tp_adaptation_set->index_.has_value() + ? tp_adaptation_set->index_.value() + : tp_adaptation_set->id()); } if (!trick_play_reference_ids.empty() && !adaptation_set.AddEssentialProperty( @@ -350,7 +358,9 @@ std::optional AdaptationSet::GetXml() { if (!switching_ids.empty()) switching_ids += ','; CHECK(s_adaptation_set->has_id()); - switching_ids += std::to_string(s_adaptation_set->id()); + switching_ids += std::to_string(s_adaptation_set->index_.has_value() + ? s_adaptation_set->index_.value() + : s_adaptation_set->id()); } if (!switching_ids.empty() && !adaptation_set.AddSupplementalProperty( @@ -454,6 +464,16 @@ void AdaptationSet::UpdateFromMediaInfo(const MediaInfo& media_info) { AddPictureAspectRatio(video_info, &picture_aspect_ratio_); } + // the command-line index for this AdaptationSet will be the + // minimum of the Representations in the set + if (media_info.has_index()) { + if (index_.has_value()) { + index_ = std::min(index_.value(), media_info.index()); + } else { + index_ = media_info.index(); + } + } + if (media_info.has_video_info()) { content_type_ = "video"; } else if (media_info.has_audio_info()) { diff --git a/packager/mpd/base/adaptation_set.h b/packager/mpd/base/adaptation_set.h index fc463c1a7e..18046cfa4b 100644 --- a/packager/mpd/base/adaptation_set.h +++ b/packager/mpd/base/adaptation_set.h @@ -327,6 +327,9 @@ class AdaptationSet { // Transfer characteristics. uint32_t transfer_characteristics_ = 0; + + // the command-line index for this AdaptationSet + std::optional index_; }; } // namespace shaka diff --git a/packager/mpd/base/media_info.proto b/packager/mpd/base/media_info.proto index b626f6b32a..f03ecfd7dc 100644 --- a/packager/mpd/base/media_info.proto +++ b/packager/mpd/base/media_info.proto @@ -212,4 +212,7 @@ message MediaInfo { // with respect to the reference time scale. // Equal to the target segment duration times the reference time scale. optional uint64 segment_duration = 25; + + // stream index for consistent ordering of streams + optional uint32 index = 28; } diff --git a/packager/mpd/base/period.cc b/packager/mpd/base/period.cc index 4e035609a9..bc6d990ced 100644 --- a/packager/mpd/base/period.cc +++ b/packager/mpd/base/period.cc @@ -163,9 +163,12 @@ std::optional Period::GetXml(bool output_period_duration) { } // Iterate thru AdaptationSets and add them to one big Period element. + // Also force AdaptationSets Id to incremental order, which might not + // be the case if force_cl_index is used. + int idx = 0; for (const auto& adaptation_set : adaptation_sets_) { auto child = adaptation_set->GetXml(); - if (!child || !period.AddChild(std::move(*child))) + if (!child || !child->SetId(idx++) || !period.AddChild(std::move(*child))) return std::nullopt; } diff --git a/packager/mpd/base/period_unittest.cc b/packager/mpd/base/period_unittest.cc index 928586421c..e6c433d3a8 100644 --- a/packager/mpd/base/period_unittest.cc +++ b/packager/mpd/base/period_unittest.cc @@ -135,7 +135,7 @@ TEST_F(PeriodTest, GetXml) { "" // ContentType and Representation elements are populated after // Representation::Init() is called. - " " + " " ""; EXPECT_THAT(testable_period_.GetXml(!kOutputPeriodDuration), XmlNodeEqual(kExpectedXml)); @@ -167,7 +167,7 @@ TEST_F(PeriodTest, DynamicMpdGetXml) { "" // ContentType and Representation elements are populated after // Representation::Init() is called. - " " + " " ""; EXPECT_THAT(testable_period_.GetXml(!kOutputPeriodDuration), XmlNodeEqual(kExpectedXml)); @@ -207,7 +207,7 @@ TEST_F(PeriodTest, LowLatencyDashMpdGetXml) { " " // ContentType and Representation elements are populated after // Representation::Init() is called. - " " + " " ""; EXPECT_THAT(testable_period_.GetXml(!kOutputPeriodDuration), XmlNodeEqual(kExpectedXml)); @@ -240,7 +240,7 @@ TEST_F(PeriodTest, SetDurationAndGetXml) { "" // ContentType and Representation elements are populated after // Representation::Init() is called. - " " + " " ""; EXPECT_THAT(testable_period_.GetXml(kOutputPeriodDuration), XmlNodeEqual(kExpectedXml)); @@ -248,7 +248,7 @@ TEST_F(PeriodTest, SetDurationAndGetXml) { "" // ContentType and Representation elements are populated after // Representation::Init() is called. - " " + " " ""; EXPECT_THAT(testable_period_.GetXml(!kOutputPeriodDuration), XmlNodeEqual(kExpectedXmlSuppressDuration)); @@ -582,14 +582,14 @@ TEST_F(PeriodTest, OrderedByAdaptationSetId) { ConvertToMediaInfo(kContent2), content_protection_in_adaptation_set_)); - adaptation_set_1_ptr->set_id(2); - adaptation_set_2_ptr->set_id(1); + adaptation_set_1_ptr->set_id(1); + adaptation_set_2_ptr->set_id(0); const char kExpectedXml[] = R"()" // ContentType and Representation elements are populated after // Representation::Init() is called. + R"( )" R"( )" - R"( )" R"()"; EXPECT_THAT(testable_period_.GetXml(!kOutputPeriodDuration), XmlNodeEqual(kExpectedXml)); 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 0da72fba08..87e1dd3fff 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,7 +1,7 @@ - + test_output_file_name1.mp4 @@ -9,7 +9,7 @@ - + test_output_file_name_audio1.mp4 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 8d66cd8ca8..00203ca011 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,7 +1,7 @@ - + test_output_file_name1.mp4 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 927fe1cada..269efc840e 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,7 +1,7 @@ - + test_output_file_name1.mp4 diff --git a/packager/packager.cc b/packager/packager.cc index 05993f978d..a6b759cf7c 100644 --- a/packager/packager.cc +++ b/packager/packager.cc @@ -74,6 +74,7 @@ MuxerListenerFactory::StreamData ToMuxerListenerData( data.dash_accessiblities = stream.dash_accessiblities; data.dash_roles = stream.dash_roles; data.dash_only = stream.dash_only; + data.index = stream.index; return data; };