Skip to content

Commit 0fd815a

Browse files
authored
fix: duplicate representation id for TTML when forced ordering is on (#1364)
Fixes #1362
1 parent 6bff14f commit 0fd815a

File tree

6 files changed

+53
-0
lines changed

6 files changed

+53
-0
lines changed

packager/app/test/packager_test.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1732,6 +1732,18 @@ def testForcedCommandlineOrdering(self):
17321732
force_cl_index=True))
17331733
self._CheckTestResults('forced-commandline-ordering')
17341734

1735+
def testForcedCommandlineOrderingWithTTML(self):
1736+
streams = [
1737+
self._GetStream('video', test_file='bear-640x360.mp4'),
1738+
self._GetStream('audio', test_file='bear-640x360.mp4'),
1739+
self._GetStream('text', test_file='bear-english.ttml'),
1740+
]
1741+
1742+
self.assertPackageSuccess(streams,
1743+
self._GetFlags(output_dash=True, output_hls=False,
1744+
force_cl_index=True))
1745+
self._CheckTestResults('forced-commandline-ordering-ttml')
1746+
17351747
def testAllowCodecSwitchingWithCommandlineOrdering(self):
17361748
streams = [
17371749
self._GetStream('audio', test_file='bear-640x360.mp4'),
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<tt xmlns="http://www.w3.org/ns/ttml" xml:lang="en">
3+
<body>
4+
<div>
5+
<p begin="0.1s" end="0.8s">Yup, that's a bear, eh.</p>
6+
<p begin="1.0s" end="4.7s">He 's... um... doing bear-like stuff.</p>
7+
</div>
8+
</body>
9+
</tt>
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--Generated with https://github.com/shaka-project/shaka-packager version <tag>-<hash>-<test>-->
3+
<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">
4+
<Period id="0">
5+
<AdaptationSet id="0" contentType="video" width="640" height="360" frameRate="30000/1001" subsegmentAlignment="true" par="16:9">
6+
<Representation id="0" bandwidth="973483" codecs="avc1.64001e" mimeType="video/mp4" sar="1:1">
7+
<BaseURL>bear-640x360-video.mp4</BaseURL>
8+
<SegmentBase indexRange="870-937" timescale="30000">
9+
<Initialization range="0-869"/>
10+
</SegmentBase>
11+
</Representation>
12+
</AdaptationSet>
13+
<AdaptationSet id="1" contentType="audio" subsegmentStartsWithSAP="1" subsegmentAlignment="true">
14+
<Representation id="1" bandwidth="133334" codecs="mp4a.40.2" mimeType="audio/mp4" audioSamplingRate="44100">
15+
<AudioChannelConfiguration schemeIdUri="urn:mpeg:dash:23003:3:audio_channel_configuration:2011" value="2"/>
16+
<BaseURL>bear-640x360-audio.mp4</BaseURL>
17+
<SegmentBase indexRange="804-871" timescale="44100">
18+
<Initialization range="0-803"/>
19+
</SegmentBase>
20+
</Representation>
21+
</AdaptationSet>
22+
<AdaptationSet id="2" contentType="text" subsegmentAlignment="true">
23+
<Representation id="2" bandwidth="256" mimeType="application/ttml+xml">
24+
<BaseURL>bear-english-text.ttml</BaseURL>
25+
</Representation>
26+
</AdaptationSet>
27+
</Period>
28+
</MPD>

packager/packager.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,10 @@ bool StreamInfoToTextMediaInfo(const StreamDescriptor& stream_descriptor,
418418
text_info->set_language(language);
419419
}
420420

421+
if (stream_descriptor.index.has_value()) {
422+
text_media_info->set_index(stream_descriptor.index.value());
423+
}
424+
421425
text_media_info->set_media_file_name(stream_descriptor.output);
422426
text_media_info->set_container_type(MediaInfo::CONTAINER_TEXT);
423427

0 commit comments

Comments
 (0)