Test DASH playback + standalone WebVTT parsed during extraction
This change applies to standalone WebVTT files linked directly from the manifest. Since DASH only supports stand-alone IMSC1 (TTML) and WebVTT text files, this change concludes the support extension of text-based subtitle files to be parse during extraction. PiperOrigin-RevId: 577468830
This commit is contained in:
parent
97efa70852
commit
1ac6263869
@ -39,7 +39,7 @@
|
||||
* HLS Extension:
|
||||
* DASH Extension:
|
||||
* Extend experimental support for parsing subtitles during extraction to
|
||||
work with standalone TTML files (previously it only worked with
|
||||
work with standalone text files (previously it only worked with
|
||||
subtitles muxed into MP4 segments).
|
||||
* Smooth Streaming Extension:
|
||||
* RTSP Extension:
|
||||
|
@ -50,6 +50,35 @@ public final class DashPlaybackTest {
|
||||
public ShadowMediaCodecConfig mediaCodecConfig =
|
||||
ShadowMediaCodecConfig.forAllSupportedMimeTypes();
|
||||
|
||||
@Test
|
||||
public void webvttStandaloneFile() throws Exception {
|
||||
Context applicationContext = ApplicationProvider.getApplicationContext();
|
||||
CapturingRenderersFactory capturingRenderersFactory =
|
||||
new CapturingRenderersFactory(applicationContext);
|
||||
ExoPlayer player =
|
||||
new ExoPlayer.Builder(applicationContext, capturingRenderersFactory)
|
||||
.setClock(new FakeClock(/* isAutoAdvancing= */ true))
|
||||
.setMediaSourceFactory(
|
||||
new DashMediaSource.Factory(new DefaultDataSource.Factory(applicationContext))
|
||||
.experimentalParseSubtitlesDuringExtraction(true))
|
||||
.build();
|
||||
player.setVideoSurface(new Surface(new SurfaceTexture(/* texName= */ 1)));
|
||||
PlaybackOutput playbackOutput = PlaybackOutput.register(player, capturingRenderersFactory);
|
||||
|
||||
// Ensure the subtitle track is selected.
|
||||
DefaultTrackSelector trackSelector =
|
||||
checkNotNull((DefaultTrackSelector) player.getTrackSelector());
|
||||
trackSelector.setParameters(trackSelector.buildUponParameters().setPreferredTextLanguage("en"));
|
||||
player.setMediaItem(MediaItem.fromUri("asset:///media/dash/standalone-webvtt/sample.mpd"));
|
||||
player.prepare();
|
||||
player.play();
|
||||
TestPlayerRunHelper.runUntilPlaybackState(player, Player.STATE_ENDED);
|
||||
player.release();
|
||||
|
||||
DumpFileAsserts.assertOutput(
|
||||
applicationContext, playbackOutput, "playbackdumps/dash/standalone-webvtt.dump");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void ttmlStandaloneXmlFile() throws Exception {
|
||||
Context applicationContext = ApplicationProvider.getApplicationContext();
|
||||
|
@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--Generated with https://github.com/google/shaka-packager version v2.4.1-c731217-release-->
|
||||
<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="PT1.0010000467300415S">
|
||||
<Period id="0">
|
||||
<AdaptationSet id="0" contentType="text" subsegmentAlignment="true" lang="eng">
|
||||
<Role schemeIdUri="urn:mpeg:dash:role:2011" value="subtitle"/>
|
||||
<Representation id="0" codecs="wvtt" mimeType="text/vtt">
|
||||
<BaseURL>sample.vtt</BaseURL>
|
||||
</Representation>
|
||||
</AdaptationSet>
|
||||
<AdaptationSet id="1" contentType="video" width="1080" height="720" frameRate="30000/1001" subsegmentAlignment="true" par="3:2">
|
||||
<Representation id="1" bandwidth="721967" codecs="avc1.64001f" mimeType="video/mp4" sar="1:1">
|
||||
<BaseURL>sample.video.mp4</BaseURL>
|
||||
<SegmentBase indexRange="862-905" timescale="30000">
|
||||
<Initialization range="0-861"/>
|
||||
</SegmentBase>
|
||||
</Representation>
|
||||
</AdaptationSet>
|
||||
</Period>
|
||||
</MPD>
|
Binary file not shown.
@ -0,0 +1,7 @@
|
||||
WEBVTT # This comment is allowed
|
||||
|
||||
00:00.020 --> 00:00.234
|
||||
This is the first subtitle.
|
||||
|
||||
00:00.100 --> 00:00.956
|
||||
This is the second subtitle.
|
@ -0,0 +1,268 @@
|
||||
MediaCodecAdapter (exotest.video.avc):
|
||||
inputBuffers:
|
||||
count = 31
|
||||
input buffer #0:
|
||||
timeUs = 1000000000000
|
||||
contents = length 36692, hash D216076E
|
||||
input buffer #1:
|
||||
timeUs = 1000000066733
|
||||
contents = length 5312, hash D45D3CA0
|
||||
input buffer #2:
|
||||
timeUs = 1000000033366
|
||||
contents = length 599, hash 1BE7812D
|
||||
input buffer #3:
|
||||
timeUs = 1000000200200
|
||||
contents = length 7735, hash 4490F110
|
||||
input buffer #4:
|
||||
timeUs = 1000000133466
|
||||
contents = length 987, hash 560B5036
|
||||
input buffer #5:
|
||||
timeUs = 1000000100100
|
||||
contents = length 673, hash ED7CD8C7
|
||||
input buffer #6:
|
||||
timeUs = 1000000166833
|
||||
contents = length 523, hash 3020DF50
|
||||
input buffer #7:
|
||||
timeUs = 1000000333666
|
||||
contents = length 6061, hash 736C72B2
|
||||
input buffer #8:
|
||||
timeUs = 1000000266933
|
||||
contents = length 992, hash FE132F23
|
||||
input buffer #9:
|
||||
timeUs = 1000000233566
|
||||
contents = length 623, hash 5B2C1816
|
||||
input buffer #10:
|
||||
timeUs = 1000000300300
|
||||
contents = length 421, hash 742E69C1
|
||||
input buffer #11:
|
||||
timeUs = 1000000433766
|
||||
contents = length 4899, hash F72F86A1
|
||||
input buffer #12:
|
||||
timeUs = 1000000400400
|
||||
contents = length 568, hash 519A8E50
|
||||
input buffer #13:
|
||||
timeUs = 1000000367033
|
||||
contents = length 620, hash 3990AA39
|
||||
input buffer #14:
|
||||
timeUs = 1000000567233
|
||||
contents = length 5450, hash F06EC4AA
|
||||
input buffer #15:
|
||||
timeUs = 1000000500500
|
||||
contents = length 1051, hash 92DFA63A
|
||||
input buffer #16:
|
||||
timeUs = 1000000467133
|
||||
contents = length 874, hash 69587FB4
|
||||
input buffer #17:
|
||||
timeUs = 1000000533866
|
||||
contents = length 781, hash 36BE495B
|
||||
input buffer #18:
|
||||
timeUs = 1000000700700
|
||||
contents = length 4725, hash AC0C8CD3
|
||||
input buffer #19:
|
||||
timeUs = 1000000633966
|
||||
contents = length 1022, hash 5D8BFF34
|
||||
input buffer #20:
|
||||
timeUs = 1000000600600
|
||||
contents = length 790, hash 99413A99
|
||||
input buffer #21:
|
||||
timeUs = 1000000667333
|
||||
contents = length 610, hash 5E129290
|
||||
input buffer #22:
|
||||
timeUs = 1000000834166
|
||||
contents = length 2751, hash 769974CB
|
||||
input buffer #23:
|
||||
timeUs = 1000000767433
|
||||
contents = length 745, hash B78A477A
|
||||
input buffer #24:
|
||||
timeUs = 1000000734066
|
||||
contents = length 621, hash CF741E7A
|
||||
input buffer #25:
|
||||
timeUs = 1000000800800
|
||||
contents = length 505, hash 1DB4894E
|
||||
input buffer #26:
|
||||
timeUs = 1000000967633
|
||||
contents = length 1268, hash C15348DC
|
||||
input buffer #27:
|
||||
timeUs = 1000000900900
|
||||
contents = length 880, hash C2DE85D0
|
||||
input buffer #28:
|
||||
timeUs = 1000000867533
|
||||
contents = length 530, hash C98BC6A8
|
||||
input buffer #29:
|
||||
timeUs = 1000000934266
|
||||
contents = length 568, hash 4FE5C8EA
|
||||
input buffer #30:
|
||||
timeUs = 0
|
||||
flags = 4
|
||||
contents = length 0, hash 1
|
||||
outputBuffers:
|
||||
count = 30
|
||||
output buffer #0:
|
||||
timeUs = 1000000000000
|
||||
size = 36692
|
||||
rendered = true
|
||||
output buffer #1:
|
||||
timeUs = 1000000066733
|
||||
size = 5312
|
||||
rendered = true
|
||||
output buffer #2:
|
||||
timeUs = 1000000033366
|
||||
size = 599
|
||||
rendered = true
|
||||
output buffer #3:
|
||||
timeUs = 1000000200200
|
||||
size = 7735
|
||||
rendered = true
|
||||
output buffer #4:
|
||||
timeUs = 1000000133466
|
||||
size = 987
|
||||
rendered = true
|
||||
output buffer #5:
|
||||
timeUs = 1000000100100
|
||||
size = 673
|
||||
rendered = true
|
||||
output buffer #6:
|
||||
timeUs = 1000000166833
|
||||
size = 523
|
||||
rendered = true
|
||||
output buffer #7:
|
||||
timeUs = 1000000333666
|
||||
size = 6061
|
||||
rendered = true
|
||||
output buffer #8:
|
||||
timeUs = 1000000266933
|
||||
size = 992
|
||||
rendered = true
|
||||
output buffer #9:
|
||||
timeUs = 1000000233566
|
||||
size = 623
|
||||
rendered = true
|
||||
output buffer #10:
|
||||
timeUs = 1000000300300
|
||||
size = 421
|
||||
rendered = true
|
||||
output buffer #11:
|
||||
timeUs = 1000000433766
|
||||
size = 4899
|
||||
rendered = true
|
||||
output buffer #12:
|
||||
timeUs = 1000000400400
|
||||
size = 568
|
||||
rendered = true
|
||||
output buffer #13:
|
||||
timeUs = 1000000367033
|
||||
size = 620
|
||||
rendered = true
|
||||
output buffer #14:
|
||||
timeUs = 1000000567233
|
||||
size = 5450
|
||||
rendered = true
|
||||
output buffer #15:
|
||||
timeUs = 1000000500500
|
||||
size = 1051
|
||||
rendered = true
|
||||
output buffer #16:
|
||||
timeUs = 1000000467133
|
||||
size = 874
|
||||
rendered = true
|
||||
output buffer #17:
|
||||
timeUs = 1000000533866
|
||||
size = 781
|
||||
rendered = true
|
||||
output buffer #18:
|
||||
timeUs = 1000000700700
|
||||
size = 4725
|
||||
rendered = true
|
||||
output buffer #19:
|
||||
timeUs = 1000000633966
|
||||
size = 1022
|
||||
rendered = true
|
||||
output buffer #20:
|
||||
timeUs = 1000000600600
|
||||
size = 790
|
||||
rendered = true
|
||||
output buffer #21:
|
||||
timeUs = 1000000667333
|
||||
size = 610
|
||||
rendered = true
|
||||
output buffer #22:
|
||||
timeUs = 1000000834166
|
||||
size = 2751
|
||||
rendered = true
|
||||
output buffer #23:
|
||||
timeUs = 1000000767433
|
||||
size = 745
|
||||
rendered = true
|
||||
output buffer #24:
|
||||
timeUs = 1000000734066
|
||||
size = 621
|
||||
rendered = true
|
||||
output buffer #25:
|
||||
timeUs = 1000000800800
|
||||
size = 505
|
||||
rendered = true
|
||||
output buffer #26:
|
||||
timeUs = 1000000967633
|
||||
size = 1268
|
||||
rendered = true
|
||||
output buffer #27:
|
||||
timeUs = 1000000900900
|
||||
size = 880
|
||||
rendered = true
|
||||
output buffer #28:
|
||||
timeUs = 1000000867533
|
||||
size = 530
|
||||
rendered = true
|
||||
output buffer #29:
|
||||
timeUs = 1000000934266
|
||||
size = 568
|
||||
rendered = true
|
||||
TextOutput:
|
||||
Subtitle[0]:
|
||||
presentationTimeUs = 0
|
||||
Cues = []
|
||||
Subtitle[1]:
|
||||
presentationTimeUs = 20000
|
||||
Cue[0]:
|
||||
text = This is the first subtitle.
|
||||
textAlignment = ALIGN_CENTER
|
||||
line = -1.0
|
||||
lineType = 1
|
||||
lineAnchor = 0
|
||||
position = 0.5
|
||||
positionAnchor = 1
|
||||
size = 1.0
|
||||
Subtitle[2]:
|
||||
presentationTimeUs = 100000
|
||||
Cue[0]:
|
||||
text = This is the first subtitle.
|
||||
textAlignment = ALIGN_CENTER
|
||||
line = -1.0
|
||||
lineType = 1
|
||||
lineAnchor = 0
|
||||
position = 0.5
|
||||
positionAnchor = 1
|
||||
size = 1.0
|
||||
Cue[1]:
|
||||
text = This is the second subtitle.
|
||||
textAlignment = ALIGN_CENTER
|
||||
line = -2.0
|
||||
lineType = 1
|
||||
lineAnchor = 0
|
||||
position = 0.5
|
||||
positionAnchor = 1
|
||||
size = 1.0
|
||||
Subtitle[3]:
|
||||
presentationTimeUs = 234000
|
||||
Cue[0]:
|
||||
text = This is the second subtitle.
|
||||
textAlignment = ALIGN_CENTER
|
||||
line = -1.0
|
||||
lineType = 1
|
||||
lineAnchor = 0
|
||||
position = 0.5
|
||||
positionAnchor = 1
|
||||
size = 1.0
|
||||
Subtitle[4]:
|
||||
presentationTimeUs = 956000
|
||||
Cues = []
|
Loading…
x
Reference in New Issue
Block a user