mirror of
https://github.com/androidx/media.git
synced 2025-04-30 06:46:50 +08:00
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:
parent
b4860fada0
commit
1cfaae3450
@ -18,12 +18,10 @@ package androidx.media3.exoplayer.e2etest;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.graphics.SurfaceTexture;
|
import android.graphics.SurfaceTexture;
|
||||||
import android.view.Surface;
|
import android.view.Surface;
|
||||||
import androidx.media3.common.C;
|
|
||||||
import androidx.media3.common.MediaItem;
|
import androidx.media3.common.MediaItem;
|
||||||
import androidx.media3.common.Player;
|
import androidx.media3.common.Player;
|
||||||
import androidx.media3.exoplayer.ExoPlayer;
|
import androidx.media3.exoplayer.ExoPlayer;
|
||||||
import androidx.media3.exoplayer.source.DefaultMediaSourceFactory;
|
import androidx.media3.exoplayer.source.DefaultMediaSourceFactory;
|
||||||
import androidx.media3.exoplayer.trackselection.DefaultTrackSelector;
|
|
||||||
import androidx.media3.extractor.DefaultExtractorsFactory;
|
import androidx.media3.extractor.DefaultExtractorsFactory;
|
||||||
import androidx.media3.test.utils.CapturingRenderersFactory;
|
import androidx.media3.test.utils.CapturingRenderersFactory;
|
||||||
import androidx.media3.test.utils.DumpFileAsserts;
|
import androidx.media3.test.utils.DumpFileAsserts;
|
||||||
@ -77,20 +75,6 @@ public final class MkvPlaybackTest {
|
|||||||
new ExoPlayer.Builder(applicationContext, capturingRenderersFactory, mediaSourceFactory)
|
new ExoPlayer.Builder(applicationContext, capturingRenderersFactory, mediaSourceFactory)
|
||||||
.setClock(new FakeClock(/* isAutoAdvancing= */ true))
|
.setClock(new FakeClock(/* isAutoAdvancing= */ true))
|
||||||
.build();
|
.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));
|
Surface surface = new Surface(new SurfaceTexture(/* texName= */ 1));
|
||||||
player.setVideoSurface(surface);
|
player.setVideoSurface(surface);
|
||||||
PlaybackOutput playbackOutput = PlaybackOutput.register(player, capturingRenderersFactory);
|
PlaybackOutput playbackOutput = PlaybackOutput.register(player, capturingRenderersFactory);
|
||||||
|
@ -522,3 +522,18 @@ AudioSink:
|
|||||||
buffer #28:
|
buffer #28:
|
||||||
time = 1000001037319
|
time = 1000001037319
|
||||||
data = 1
|
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
|
||||||
|
@ -522,3 +522,18 @@ AudioSink:
|
|||||||
buffer #28:
|
buffer #28:
|
||||||
time = 1000001037319
|
time = 1000001037319
|
||||||
data = 1
|
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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user