use of com.google.android.exoplayer2.trackselection.TrackSelectionOverrides.TrackSelectionOverride in project ExoPlayer by google.
the class TrackSelectionOverridesTest method newTrackSelectionOverride_withJustTrackGroup_selectsAllTracks.
@Test
public void newTrackSelectionOverride_withJustTrackGroup_selectsAllTracks() {
TrackSelectionOverride trackSelectionOverride = new TrackSelectionOverride(newTrackGroupWithIds(1, 2));
assertThat(trackSelectionOverride.trackGroup).isEqualTo(newTrackGroupWithIds(1, 2));
assertThat(trackSelectionOverride.trackIndices).containsExactly(0, 1).inOrder();
}
use of com.google.android.exoplayer2.trackselection.TrackSelectionOverrides.TrackSelectionOverride in project ExoPlayer by google.
the class TrackSelectionOverridesTest method clearOverride_ofTypeGroup_removesOverride.
@Test
public void clearOverride_ofTypeGroup_removesOverride() {
TrackSelectionOverride override1 = new TrackSelectionOverride(AAC_TRACK_GROUP);
TrackSelectionOverride override2 = new TrackSelectionOverride(newTrackGroupWithIds(1));
TrackSelectionOverrides trackSelectionOverrides = new TrackSelectionOverrides.Builder().addOverride(override1).addOverride(override2).clearOverride(override2.trackGroup).build();
assertThat(trackSelectionOverrides.asList()).containsExactly(override1);
assertThat(trackSelectionOverrides.getOverride(override1.trackGroup)).isEqualTo(override1);
}
use of com.google.android.exoplayer2.trackselection.TrackSelectionOverrides.TrackSelectionOverride in project ExoPlayer by google.
the class TrackSelectionOverridesTest method addOverride_onDifferentGroups_addsOverride.
@Test
public void addOverride_onDifferentGroups_addsOverride() {
TrackSelectionOverride override1 = new TrackSelectionOverride(newTrackGroupWithIds(1));
TrackSelectionOverride override2 = new TrackSelectionOverride(newTrackGroupWithIds(2));
TrackSelectionOverrides trackSelectionOverrides = new TrackSelectionOverrides.Builder().addOverride(override1).addOverride(override2).build();
assertThat(trackSelectionOverrides.asList()).containsExactly(override1, override2);
assertThat(trackSelectionOverrides.getOverride(override1.trackGroup)).isEqualTo(override1);
assertThat(trackSelectionOverrides.getOverride(override2.trackGroup)).isEqualTo(override2);
}
use of com.google.android.exoplayer2.trackselection.TrackSelectionOverrides.TrackSelectionOverride in project ExoPlayer by google.
the class TrackSelectionOverridesTest method newTrackSelectionOverride_withTracks_selectsOnlySpecifiedTracks.
@Test
public void newTrackSelectionOverride_withTracks_selectsOnlySpecifiedTracks() {
TrackSelectionOverride trackSelectionOverride = new TrackSelectionOverride(newTrackGroupWithIds(1, 2), ImmutableList.of(1));
assertThat(trackSelectionOverride.trackGroup).isEqualTo(newTrackGroupWithIds(1, 2));
assertThat(trackSelectionOverride.trackIndices).containsExactly(1);
}
use of com.google.android.exoplayer2.trackselection.TrackSelectionOverrides.TrackSelectionOverride in project ExoPlayer by google.
the class DefaultTrackSelectorTest method selectTrack_withMixedEmptyAndNonEmptyTrackOverrides_appliesNonEmptyOverride.
@Test
public void selectTrack_withMixedEmptyAndNonEmptyTrackOverrides_appliesNonEmptyOverride() throws Exception {
TrackGroup videoGroupHighBitrate = new TrackGroup(VIDEO_FORMAT.buildUpon().setAverageBitrate(1_000_000).build());
TrackGroup videoGroupMidBitrate = new TrackGroup(VIDEO_FORMAT.buildUpon().setAverageBitrate(500_000).build());
TrackGroup videoGroupLowBitrate = new TrackGroup(VIDEO_FORMAT.buildUpon().setAverageBitrate(100_000).build());
trackSelector.setParameters(trackSelector.buildUponParameters().setTrackSelectionOverrides(new TrackSelectionOverrides.Builder().addOverride(new TrackSelectionOverride(videoGroupHighBitrate, /* trackIndices= */
ImmutableList.of())).addOverride(new TrackSelectionOverride(videoGroupMidBitrate, /* trackIndices= */
ImmutableList.of(0))).addOverride(new TrackSelectionOverride(videoGroupLowBitrate, /* trackIndices= */
ImmutableList.of())).build()));
TrackSelectorResult result = trackSelector.selectTracks(RENDERER_CAPABILITIES, new TrackGroupArray(videoGroupHighBitrate, videoGroupMidBitrate, videoGroupLowBitrate), periodId, TIMELINE);
assertThat(result.selections).asList().containsExactly(new FixedTrackSelection(videoGroupMidBitrate, /* track= */
0), null).inOrder();
}
Aggregations