Enable WebVTT subtitles in MkvPlaybackTest

This is no longer flaky because WebVTT subtitles are decoded on the
loading thread (enabled in this test with
`defaultExractorsFactory.setTextTrackTranscodingEnabled(true)` - and
supported for WebVTT since f0f24aa0d4).

PiperOrigin-RevId: 549594291
This commit is contained in:
ibaker 2023-07-20 12:41:35 +01:00 committed by Rohit Singh
parent b4860fada0
commit 1cfaae3450
3 changed files with 30 additions and 16 deletions

View File

@ -18,12 +18,10 @@ package androidx.media3.exoplayer.e2etest;
import android.content.Context;
import android.graphics.SurfaceTexture;
import android.view.Surface;
import androidx.media3.common.C;
import androidx.media3.common.MediaItem;
import androidx.media3.common.Player;
import androidx.media3.exoplayer.ExoPlayer;
import androidx.media3.exoplayer.source.DefaultMediaSourceFactory;
import androidx.media3.exoplayer.trackselection.DefaultTrackSelector;
import androidx.media3.extractor.DefaultExtractorsFactory;
import androidx.media3.test.utils.CapturingRenderersFactory;
import androidx.media3.test.utils.DumpFileAsserts;
@ -77,20 +75,6 @@ public final class MkvPlaybackTest {
new ExoPlayer.Builder(applicationContext, capturingRenderersFactory, mediaSourceFactory)
.setClock(new FakeClock(/* isAutoAdvancing= */ true))
.build();
// TODO: b/181312195 - Remove this when WebVTT is supported by DefaultSubtitleParserFactory.
if (inputFile.contains("_vtt_")) {
for (int textRendererIndex = 0;
textRendererIndex < player.getRendererCount();
textRendererIndex++) {
if (player.getRendererType(textRendererIndex) == C.TRACK_TYPE_TEXT) {
player.setTrackSelectionParameters(
new DefaultTrackSelector.ParametersBuilder(applicationContext)
.setRendererDisabled(textRendererIndex, /* disabled= */ true)
.build());
break;
}
}
}
Surface surface = new Surface(new SurfaceTexture(/* texName= */ 1));
player.setVideoSurface(surface);
PlaybackOutput playbackOutput = PlaybackOutput.register(player, capturingRenderersFactory);

View File

@ -522,3 +522,18 @@ AudioSink:
buffer #28:
time = 1000001037319
data = 1
TextOutput:
Subtitle[0]:
presentationTimeUs = 0
Cues = []
Subtitle[1]:
presentationTimeUs = 0
Cue[0]:
text = This is the first
textAlignment = ALIGN_CENTER
line = -1.0
lineType = 1
lineAnchor = 0
position = 0.5
positionAnchor = 1
size = 1.0

View File

@ -522,3 +522,18 @@ AudioSink:
buffer #28:
time = 1000001037319
data = 1
TextOutput:
Subtitle[0]:
presentationTimeUs = 0
Cues = []
Subtitle[1]:
presentationTimeUs = 0
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