fix: duplicate representation id for TTML when forced ordering is on (#1364)

Fixes #1362
This commit is contained in:
Cosmin Stejerean 2024-03-07 10:32:09 -08:00 committed by GitHub
parent 6bff14f359
commit 0fd815a160
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 53 additions and 0 deletions

View File

@ -1732,6 +1732,18 @@ class PackagerFunctionalTest(PackagerAppTest):
force_cl_index=True))
self._CheckTestResults('forced-commandline-ordering')
def testForcedCommandlineOrderingWithTTML(self):
streams = [
self._GetStream('video', test_file='bear-640x360.mp4'),
self._GetStream('audio', test_file='bear-640x360.mp4'),
self._GetStream('text', test_file='bear-english.ttml'),
]
self.assertPackageSuccess(streams,
self._GetFlags(output_dash=True, output_hls=False,
force_cl_index=True))
self._CheckTestResults('forced-commandline-ordering-ttml')
def testAllowCodecSwitchingWithCommandlineOrdering(self):
streams = [
self._GetStream('audio', test_file='bear-640x360.mp4'),

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<tt xmlns="http://www.w3.org/ns/ttml" xml:lang="en">
<body>
<div>
<p begin="0.1s" end="0.8s">Yup, that's a bear, eh.</p>
<p begin="1.0s" end="4.7s">He 's... um... doing bear-like stuff.</p>
</div>
</body>
</tt>

View File

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--Generated with https://github.com/shaka-project/shaka-packager version <tag>-<hash>-<test>-->
<MPD xmlns="urn:mpeg:dash:schema:mpd:2011" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:mpeg:dash:schema:mpd:2011 DASH-MPD.xsd" profiles="urn:mpeg:dash:profile:isoff-on-demand:2011" minBufferTime="PT2S" type="static" mediaPresentationDuration="PT2.736067S">
<Period id="0">
<AdaptationSet id="0" contentType="video" width="640" height="360" frameRate="30000/1001" subsegmentAlignment="true" par="16:9">
<Representation id="0" bandwidth="973483" codecs="avc1.64001e" mimeType="video/mp4" sar="1:1">
<BaseURL>bear-640x360-video.mp4</BaseURL>
<SegmentBase indexRange="870-937" timescale="30000">
<Initialization range="0-869"/>
</SegmentBase>
</Representation>
</AdaptationSet>
<AdaptationSet id="1" contentType="audio" subsegmentStartsWithSAP="1" subsegmentAlignment="true">
<Representation id="1" bandwidth="133334" codecs="mp4a.40.2" mimeType="audio/mp4" audioSamplingRate="44100">
<AudioChannelConfiguration schemeIdUri="urn:mpeg:dash:23003:3:audio_channel_configuration:2011" value="2"/>
<BaseURL>bear-640x360-audio.mp4</BaseURL>
<SegmentBase indexRange="804-871" timescale="44100">
<Initialization range="0-803"/>
</SegmentBase>
</Representation>
</AdaptationSet>
<AdaptationSet id="2" contentType="text" subsegmentAlignment="true">
<Representation id="2" bandwidth="256" mimeType="application/ttml+xml">
<BaseURL>bear-english-text.ttml</BaseURL>
</Representation>
</AdaptationSet>
</Period>
</MPD>

View File

@ -418,6 +418,10 @@ bool StreamInfoToTextMediaInfo(const StreamDescriptor& stream_descriptor,
text_info->set_language(language);
}
if (stream_descriptor.index.has_value()) {
text_media_info->set_index(stream_descriptor.index.value());
}
text_media_info->set_media_file_name(stream_descriptor.output);
text_media_info->set_container_type(MediaInfo::CONTAINER_TEXT);