Skip to content

Commit

Permalink
fix: duplicate representation id for TTML when forced ordering is on (#…
Browse files Browse the repository at this point in the history
…1364)

Fixes #1362
  • Loading branch information
cosmin committed Mar 7, 2024
1 parent 6bff14f commit 0fd815a
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 0 deletions.
12 changes: 12 additions & 0 deletions packager/app/test/packager_test.py
Expand Up @@ -1732,6 +1732,18 @@ def testForcedCommandlineOrdering(self):
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'),
Expand Down
Binary file not shown.
Binary file not shown.
@@ -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>
@@ -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>
4 changes: 4 additions & 0 deletions packager/packager.cc
Expand Up @@ -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);

Expand Down

0 comments on commit 0fd815a

Please sign in to comment.