Commit fbd82734 by olly Committed by Ian Baker

Tracks.Group/TrackGroup variable naming disambiguation

PiperOrigin-RevId: 441712166
parent e077c766
......@@ -136,7 +136,7 @@ player.setTrackSelectionParameters(
.buildUpon()
.setOverrideForType(
new TrackSelectionOverride(
audioTrackGroup.getTrackGroup(),
audioTrackGroup.getMediaTrackGroup(),
/* trackIndex= */ 0))
.build());
~~~
......@@ -171,7 +171,8 @@ player.setTrackSelectionParameters(
.buildUpon()
.addOverride(
new TrackSelectionOverride(
disabledTrackGroup.getTrackGroup(), ImmutableList.of()))
disabledTrackGroup.getMediaTrackGroup(),
/* trackIndices= */ ImmutableList.of()))
.build());
~~~
{: .language-java}
......
......@@ -49,7 +49,7 @@ public final class Tracks implements Bundleable {
/** The number of tracks in the group. */
public final int length;
private final TrackGroup trackGroup;
private final TrackGroup mediaTrackGroup;
private final boolean adaptiveSupported;
private final @C.FormatSupport int[] trackSupport;
private final boolean[] trackSelected;
......@@ -57,28 +57,35 @@ public final class Tracks implements Bundleable {
/**
* Constructs an instance.
*
* @param trackGroup The underlying {@link TrackGroup}.
* @param mediaTrackGroup The underlying {@link TrackGroup} defined by the media.
* @param adaptiveSupported Whether the player supports adaptive selections containing more than
* one track in the group.
* @param trackSupport The {@link C.FormatSupport} of each track in the group.
* @param trackSelected Whether each track in the {@code trackGroup} is selected.
*/
public Group(
TrackGroup trackGroup,
TrackGroup mediaTrackGroup,
boolean adaptiveSupported,
@C.FormatSupport int[] trackSupport,
boolean[] trackSelected) {
length = trackGroup.length;
length = mediaTrackGroup.length;
checkArgument(length == trackSupport.length && length == trackSelected.length);
this.trackGroup = trackGroup;
this.mediaTrackGroup = mediaTrackGroup;
this.adaptiveSupported = adaptiveSupported && length > 1;
this.trackSupport = trackSupport.clone();
this.trackSelected = trackSelected.clone();
}
/** Returns the underlying {@link TrackGroup}. */
public TrackGroup getTrackGroup() {
return trackGroup;
/**
* Returns the underlying {@link TrackGroup} defined by the media.
*
* <p>Unlike this class, {@link TrackGroup} only contains information defined by the media
* itself, and does not contain runtime information such as which tracks are supported and
* currently selected. This makes it suitable for use as a {@code key} in certain {@code (key,
* value)} data structures.
*/
public TrackGroup getMediaTrackGroup() {
return mediaTrackGroup;
}
/**
......@@ -88,7 +95,7 @@ public final class Tracks implements Bundleable {
* @return The {@link Format} of the track.
*/
public Format getTrackFormat(int trackIndex) {
return trackGroup.getFormat(trackIndex);
return mediaTrackGroup.getFormat(trackIndex);
}
/**
......@@ -185,7 +192,7 @@ public final class Tracks implements Bundleable {
/** Returns the {@link C.TrackType} of the group. */
public @C.TrackType int getType() {
return trackGroup.type;
return mediaTrackGroup.type;
}
@Override
......@@ -198,14 +205,14 @@ public final class Tracks implements Bundleable {
}
Group that = (Group) other;
return adaptiveSupported == that.adaptiveSupported
&& trackGroup.equals(that.trackGroup)
&& mediaTrackGroup.equals(that.mediaTrackGroup)
&& Arrays.equals(trackSupport, that.trackSupport)
&& Arrays.equals(trackSelected, that.trackSelected);
}
@Override
public int hashCode() {
int result = trackGroup.hashCode();
int result = mediaTrackGroup.hashCode();
result = 31 * result + (adaptiveSupported ? 1 : 0);
result = 31 * result + Arrays.hashCode(trackSupport);
result = 31 * result + Arrays.hashCode(trackSelected);
......@@ -232,7 +239,7 @@ public final class Tracks implements Bundleable {
@Override
public Bundle toBundle() {
Bundle bundle = new Bundle();
bundle.putBundle(keyForField(FIELD_TRACK_GROUP), trackGroup.toBundle());
bundle.putBundle(keyForField(FIELD_TRACK_GROUP), mediaTrackGroup.toBundle());
bundle.putIntArray(keyForField(FIELD_TRACK_SUPPORT), trackSupport);
bundle.putBooleanArray(keyForField(FIELD_TRACK_SELECTED), trackSelected);
bundle.putBoolean(keyForField(FIELD_ADAPTIVE_SUPPORTED), adaptiveSupported);
......
......@@ -38,8 +38,8 @@ import java.util.Arrays;
import java.util.List;
/**
* An immutable group of tracks. All tracks in a group present the same content, but their formats
* may differ.
* An immutable group of tracks available within a media stream. All tracks in a group present the
* same content, but their formats may differ.
*
* <p>As an example of how tracks can be grouped, consider an adaptive playback where a main video
* feed is provided in five resolutions, and an alternative video feed (e.g., a different camera
......@@ -51,6 +51,10 @@ import java.util.List;
* languages is not considered to be the same. Conversely, audio tracks in the same language that
* only differ in properties such as bitrate, sampling rate, channel count and so on can be grouped.
* This also applies to text tracks.
*
* <p>Note also that this class only contains information derived from the media itself. Unlike
* {@link Tracks.Group}, it does not include runtime information such as the extent to which
* playback of each track is supported by the device, or which tracks are currently selected.
*/
public final class TrackGroup implements Bundleable {
......
......@@ -51,8 +51,8 @@ import java.util.List;
*/
public final class TrackSelectionOverride implements Bundleable {
/** The {@link TrackGroup} whose {@link #trackIndices} are forced to be selected. */
public final TrackGroup trackGroup;
/** The media {@link TrackGroup} whose {@link #trackIndices} are forced to be selected. */
public final TrackGroup mediaTrackGroup;
/** The indices of tracks in a {@link TrackGroup} to be selected. */
public final ImmutableList<Integer> trackIndices;
......@@ -70,32 +70,32 @@ public final class TrackSelectionOverride implements Bundleable {
/**
* Constructs an instance to force {@code trackIndex} in {@code trackGroup} to be selected.
*
* @param trackGroup The {@link TrackGroup} for which to override the track selection.
* @param mediaTrackGroup The media {@link TrackGroup} for which to override the track selection.
* @param trackIndex The index of the track in the {@link TrackGroup} to select.
*/
public TrackSelectionOverride(TrackGroup trackGroup, int trackIndex) {
this(trackGroup, ImmutableList.of(trackIndex));
public TrackSelectionOverride(TrackGroup mediaTrackGroup, int trackIndex) {
this(mediaTrackGroup, ImmutableList.of(trackIndex));
}
/**
* Constructs an instance to force {@code trackIndices} in {@code trackGroup} to be selected.
*
* @param trackGroup The {@link TrackGroup} for which to override the track selection.
* @param mediaTrackGroup The media {@link TrackGroup} for which to override the track selection.
* @param trackIndices The indices of the tracks in the {@link TrackGroup} to select.
*/
public TrackSelectionOverride(TrackGroup trackGroup, List<Integer> trackIndices) {
public TrackSelectionOverride(TrackGroup mediaTrackGroup, List<Integer> trackIndices) {
if (!trackIndices.isEmpty()) {
if (min(trackIndices) < 0 || max(trackIndices) >= trackGroup.length) {
if (min(trackIndices) < 0 || max(trackIndices) >= mediaTrackGroup.length) {
throw new IndexOutOfBoundsException();
}
}
this.trackGroup = trackGroup;
this.mediaTrackGroup = mediaTrackGroup;
this.trackIndices = ImmutableList.copyOf(trackIndices);
}
/** Returns the {@link C.TrackType} of the overridden track group. */
public @C.TrackType int getType() {
return trackGroup.type;
return mediaTrackGroup.type;
}
@Override
......@@ -107,12 +107,12 @@ public final class TrackSelectionOverride implements Bundleable {
return false;
}
TrackSelectionOverride that = (TrackSelectionOverride) obj;
return trackGroup.equals(that.trackGroup) && trackIndices.equals(that.trackIndices);
return mediaTrackGroup.equals(that.mediaTrackGroup) && trackIndices.equals(that.trackIndices);
}
@Override
public int hashCode() {
return trackGroup.hashCode() + 31 * trackIndices.hashCode();
return mediaTrackGroup.hashCode() + 31 * trackIndices.hashCode();
}
// Bundleable implementation
......@@ -120,7 +120,7 @@ public final class TrackSelectionOverride implements Bundleable {
@Override
public Bundle toBundle() {
Bundle bundle = new Bundle();
bundle.putBundle(keyForField(FIELD_TRACK_GROUP), trackGroup.toBundle());
bundle.putBundle(keyForField(FIELD_TRACK_GROUP), mediaTrackGroup.toBundle());
bundle.putIntArray(keyForField(FIELD_TRACKS), Ints.toArray(trackIndices));
return bundle;
}
......@@ -129,9 +129,9 @@ public final class TrackSelectionOverride implements Bundleable {
public static final Creator<TrackSelectionOverride> CREATOR =
bundle -> {
Bundle trackGroupBundle = checkNotNull(bundle.getBundle(keyForField(FIELD_TRACK_GROUP)));
TrackGroup trackGroup = TrackGroup.CREATOR.fromBundle(trackGroupBundle);
TrackGroup mediaTrackGroup = TrackGroup.CREATOR.fromBundle(trackGroupBundle);
int[] tracks = checkNotNull(bundle.getIntArray(keyForField(FIELD_TRACKS)));
return new TrackSelectionOverride(trackGroup, Ints.asList(tracks));
return new TrackSelectionOverride(mediaTrackGroup, Ints.asList(tracks));
};
private static String keyForField(@FieldNumber int field) {
......
......@@ -254,7 +254,7 @@ public class TrackSelectionParameters implements Bundleable {
overrides = new HashMap<>();
for (int i = 0; i < overrideList.size(); i++) {
TrackSelectionOverride override = overrideList.get(i);
overrides.put(override.trackGroup, override);
overrides.put(override.mediaTrackGroup, override);
}
int[] disabledTrackTypeArray =
firstNonNull(bundle.getIntArray(keyForField(FIELD_DISABLED_TRACK_TYPE)), new int[0]);
......@@ -676,20 +676,20 @@ public class TrackSelectionParameters implements Bundleable {
/** Adds an override, replacing any override for the same {@link TrackGroup}. */
public Builder addOverride(TrackSelectionOverride override) {
overrides.put(override.trackGroup, override);
overrides.put(override.mediaTrackGroup, override);
return this;
}
/** Sets an override, replacing all existing overrides with the same track type. */
public Builder setOverrideForType(TrackSelectionOverride override) {
clearOverridesOfType(override.getType());
overrides.put(override.trackGroup, override);
overrides.put(override.mediaTrackGroup, override);
return this;
}
/** Removes the override for the provided {@link TrackGroup}, if there is one. */
public Builder clearOverride(TrackGroup trackGroup) {
overrides.remove(trackGroup);
/** Removes the override for the provided media {@link TrackGroup}, if there is one. */
public Builder clearOverride(TrackGroup mediaTrackGroup) {
overrides.remove(mediaTrackGroup);
return this;
}
......
......@@ -35,7 +35,7 @@ public final class TrackSelectionOverrideTest {
TrackSelectionOverride trackSelectionOverride =
new TrackSelectionOverride(newTrackGroupWithIds(1, 2), /* trackIndex= */ 1);
assertThat(trackSelectionOverride.trackGroup).isEqualTo(newTrackGroupWithIds(1, 2));
assertThat(trackSelectionOverride.mediaTrackGroup).isEqualTo(newTrackGroupWithIds(1, 2));
assertThat(trackSelectionOverride.trackIndices).containsExactly(1).inOrder();
}
......@@ -44,7 +44,7 @@ public final class TrackSelectionOverrideTest {
TrackSelectionOverride trackSelectionOverride =
new TrackSelectionOverride(newTrackGroupWithIds(1, 2), ImmutableList.of(1));
assertThat(trackSelectionOverride.trackGroup).isEqualTo(newTrackGroupWithIds(1, 2));
assertThat(trackSelectionOverride.mediaTrackGroup).isEqualTo(newTrackGroupWithIds(1, 2));
assertThat(trackSelectionOverride.trackIndices).containsExactly(1);
}
......@@ -53,7 +53,7 @@ public final class TrackSelectionOverrideTest {
TrackSelectionOverride trackSelectionOverride =
new TrackSelectionOverride(newTrackGroupWithIds(1, 2), ImmutableList.of());
assertThat(trackSelectionOverride.trackGroup).isEqualTo(newTrackGroupWithIds(1, 2));
assertThat(trackSelectionOverride.mediaTrackGroup).isEqualTo(newTrackGroupWithIds(1, 2));
assertThat(trackSelectionOverride.trackIndices).isEmpty();
}
......
......@@ -153,7 +153,8 @@ public final class TrackSelectionParametersTest {
assertThat(parameters.forceLowestBitrate).isFalse();
assertThat(parameters.forceHighestSupportedBitrate).isTrue();
assertThat(parameters.overrides)
.containsExactly(override1.trackGroup, override1, override2.trackGroup, override2);
.containsExactly(
override1.mediaTrackGroup, override1, override2.mediaTrackGroup, override2);
assertThat(parameters.disabledTrackTypes)
.containsExactly(C.TRACK_TYPE_AUDIO, C.TRACK_TYPE_TEXT);
}
......@@ -207,7 +208,8 @@ public final class TrackSelectionParametersTest {
TrackSelectionParameters.CREATOR.fromBundle(trackSelectionParameters.toBundle());
assertThat(fromBundle).isEqualTo(trackSelectionParameters);
assertThat(trackSelectionParameters.overrides).containsExactly(override.trackGroup, override);
assertThat(trackSelectionParameters.overrides)
.containsExactly(override.mediaTrackGroup, override);
}
@Test
......@@ -224,7 +226,8 @@ public final class TrackSelectionParametersTest {
.build();
assertThat(trackSelectionParameters.overrides)
.containsExactly(override1.trackGroup, override1, override2.trackGroup, override2);
.containsExactly(
override1.mediaTrackGroup, override1, override2.mediaTrackGroup, override2);
}
@Test
......@@ -241,7 +244,8 @@ public final class TrackSelectionParametersTest {
.addOverride(override2)
.build();
assertThat(trackSelectionParameters.overrides).containsExactly(override2.trackGroup, override2);
assertThat(trackSelectionParameters.overrides)
.containsExactly(override2.mediaTrackGroup, override2);
}
@Test
......@@ -257,7 +261,8 @@ public final class TrackSelectionParametersTest {
.setOverrideForType(override2)
.build();
assertThat(trackSelectionParameters.overrides).containsExactly(override2.trackGroup, override2);
assertThat(trackSelectionParameters.overrides)
.containsExactly(override2.mediaTrackGroup, override2);
}
@Test
......@@ -273,7 +278,8 @@ public final class TrackSelectionParametersTest {
.clearOverridesOfType(C.TRACK_TYPE_AUDIO)
.build();
assertThat(trackSelectionParameters.overrides).containsExactly(override2.trackGroup, override2);
assertThat(trackSelectionParameters.overrides)
.containsExactly(override2.mediaTrackGroup, override2);
}
@Test
......@@ -286,10 +292,11 @@ public final class TrackSelectionParametersTest {
new TrackSelectionParameters.Builder(getApplicationContext())
.addOverride(override1)
.addOverride(override2)
.clearOverride(override2.trackGroup)
.clearOverride(override2.mediaTrackGroup)
.build();
assertThat(trackSelectionParameters.overrides).containsExactly(override1.trackGroup, override1);
assertThat(trackSelectionParameters.overrides)
.containsExactly(override1.mediaTrackGroup, override1);
}
private static TrackGroup newTrackGroupWithIds(int... ids) {
......
......@@ -1927,11 +1927,11 @@ public class DefaultTrackSelector extends MappingTrackSelector {
// want the renderer to be enabled at all, so clear any existing selection.
@Nullable ExoTrackSelection.Definition selection;
if (!overrideForType.trackIndices.isEmpty()
&& mappedTrackInfo.getTrackGroups(rendererIndex).indexOf(overrideForType.trackGroup)
&& mappedTrackInfo.getTrackGroups(rendererIndex).indexOf(overrideForType.mediaTrackGroup)
!= -1) {
selection =
new ExoTrackSelection.Definition(
overrideForType.trackGroup, Ints.toArray(overrideForType.trackIndices));
overrideForType.mediaTrackGroup, Ints.toArray(overrideForType.trackIndices));
} else {
selection = null;
}
......
......@@ -2239,7 +2239,7 @@ public final class DefaultTrackSelectorTest {
assertThat(result.selections[2]).isNull();
ImmutableList<Tracks.Group> trackGroups = result.tracks.getGroups();
assertThat(trackGroups).hasSize(1);
assertThat(trackGroups.get(0).getTrackGroup()).isEqualTo(AUDIO_TRACK_GROUP);
assertThat(trackGroups.get(0).getMediaTrackGroup()).isEqualTo(AUDIO_TRACK_GROUP);
assertThat(trackGroups.get(0).isTrackSelected(0)).isTrue();
assertThat(trackGroups.get(0).getTrackSupport(0)).isEqualTo(FORMAT_HANDLED);
}
......
......@@ -76,13 +76,13 @@ public class TrackSelectionUtilTest {
ImmutableList<Tracks.Group> trackGroups = tracks.getGroups();
assertThat(trackGroups).hasSize(4);
assertThat(trackGroups.get(0).getTrackGroup())
assertThat(trackGroups.get(0).getMediaTrackGroup())
.isEqualTo(mappedTrackInfo.getTrackGroups(0).get(0));
assertThat(trackGroups.get(1).getTrackGroup())
assertThat(trackGroups.get(1).getMediaTrackGroup())
.isEqualTo(mappedTrackInfo.getTrackGroups(0).get(1));
assertThat(trackGroups.get(2).getTrackGroup())
assertThat(trackGroups.get(2).getMediaTrackGroup())
.isEqualTo(mappedTrackInfo.getTrackGroups(1).get(0));
assertThat(trackGroups.get(3).getTrackGroup())
assertThat(trackGroups.get(3).getMediaTrackGroup())
.isEqualTo(mappedTrackInfo.getUnmappedTrackGroups().get(0));
assertThat(trackGroups.get(0).getTrackSupport(0)).isEqualTo(FORMAT_HANDLED);
assertThat(trackGroups.get(1).getTrackSupport(0)).isEqualTo(FORMAT_UNSUPPORTED_SUBTYPE);
......@@ -135,9 +135,9 @@ public class TrackSelectionUtilTest {
ImmutableList<Tracks.Group> trackGroups = tracks.getGroups();
assertThat(trackGroups).hasSize(2);
assertThat(trackGroups.get(0).getTrackGroup())
assertThat(trackGroups.get(0).getMediaTrackGroup())
.isEqualTo(mappedTrackInfo.getTrackGroups(0).get(0));
assertThat(trackGroups.get(1).getTrackGroup())
assertThat(trackGroups.get(1).getMediaTrackGroup())
.isEqualTo(mappedTrackInfo.getTrackGroups(0).get(1));
assertThat(trackGroups.get(0).getTrackSupport(0)).isEqualTo(FORMAT_HANDLED);
assertThat(trackGroups.get(1).getTrackSupport(0)).isEqualTo(FORMAT_HANDLED);
......
......@@ -1926,7 +1926,7 @@ public class StyledPlayerControlView extends FrameLayout {
private boolean hasSelectionOverride(TrackSelectionParameters trackSelectionParameters) {
for (int i = 0; i < tracks.size(); i++) {
TrackGroup trackGroup = tracks.get(i).trackGroup.getTrackGroup();
TrackGroup trackGroup = tracks.get(i).trackGroup.getMediaTrackGroup();
if (trackSelectionParameters.overrides.containsKey(trackGroup)) {
return true;
}
......@@ -2000,9 +2000,10 @@ public class StyledPlayerControlView extends FrameLayout {
onBindViewHolderAtZeroPosition(holder);
} else {
TrackInformation track = tracks.get(position - 1);
TrackGroup trackGroup = track.trackGroup.getTrackGroup();
TrackGroup mediaTrackGroup = track.trackGroup.getMediaTrackGroup();
TrackSelectionParameters params = player.getTrackSelectionParameters();
boolean explicitlySelected = params.overrides.get(trackGroup) != null && track.isSelected();
boolean explicitlySelected =
params.overrides.get(mediaTrackGroup) != null && track.isSelected();
holder.textView.setText(track.trackName);
holder.checkView.setVisibility(explicitlySelected ? VISIBLE : INVISIBLE);
holder.itemView.setOnClickListener(
......@@ -2014,7 +2015,7 @@ public class StyledPlayerControlView extends FrameLayout {
.buildUpon()
.setOverrideForType(
new TrackSelectionOverride(
trackGroup, ImmutableList.of(track.trackIndex)))
mediaTrackGroup, ImmutableList.of(track.trackIndex)))
.setTrackTypeDisabled(track.trackGroup.getType(), /* disabled= */ false)
.build());
onTrackSelection(track.trackName);
......
......@@ -152,7 +152,9 @@ public final class TrackSelectionDialogBuilder {
*/
public TrackSelectionDialogBuilder setOverride(@Nullable TrackSelectionOverride override) {
return setOverrides(
override == null ? Collections.emptyMap() : ImmutableMap.of(override.trackGroup, override));
override == null
? Collections.emptyMap()
: ImmutableMap.of(override.mediaTrackGroup, override));
}
/**
......
......@@ -70,9 +70,9 @@ public class TrackSelectionView extends LinearLayout {
HashMap<TrackGroup, TrackSelectionOverride> filteredOverrides = new HashMap<>();
for (int i = 0; i < trackGroups.size(); i++) {
Tracks.Group trackGroup = trackGroups.get(i);
@Nullable TrackSelectionOverride override = overrides.get(trackGroup.getTrackGroup());
@Nullable TrackSelectionOverride override = overrides.get(trackGroup.getMediaTrackGroup());
if (override != null && (allowMultipleOverrides || filteredOverrides.isEmpty())) {
filteredOverrides.put(override.trackGroup, override);
filteredOverrides.put(override.mediaTrackGroup, override);
}
}
return filteredOverrides;
......@@ -318,7 +318,8 @@ public class TrackSelectionView extends LinearLayout {
disableView.setChecked(isDisabled);
defaultView.setChecked(!isDisabled && overrides.size() == 0);
for (int i = 0; i < trackViews.length; i++) {
@Nullable TrackSelectionOverride override = overrides.get(trackGroups.get(i).getTrackGroup());
@Nullable
TrackSelectionOverride override = overrides.get(trackGroups.get(i).getMediaTrackGroup());
for (int j = 0; j < trackViews[i].length; j++) {
if (override != null) {
TrackInfo trackInfo = (TrackInfo) Assertions.checkNotNull(trackViews[i][j].getTag());
......@@ -357,9 +358,9 @@ public class TrackSelectionView extends LinearLayout {
private void onTrackViewClicked(View view) {
isDisabled = false;
TrackInfo trackInfo = (TrackInfo) Assertions.checkNotNull(view.getTag());
TrackGroup trackGroup = trackInfo.trackGroup.getTrackGroup();
TrackGroup mediaTrackGroup = trackInfo.trackGroup.getMediaTrackGroup();
int trackIndex = trackInfo.trackIndex;
@Nullable TrackSelectionOverride override = overrides.get(trackGroup);
@Nullable TrackSelectionOverride override = overrides.get(mediaTrackGroup);
if (override == null) {
// Start new override.
if (!allowMultipleOverrides && overrides.size() > 0) {
......@@ -367,7 +368,8 @@ public class TrackSelectionView extends LinearLayout {
overrides.clear();
}
overrides.put(
trackGroup, new TrackSelectionOverride(trackGroup, ImmutableList.of(trackIndex)));
mediaTrackGroup,
new TrackSelectionOverride(mediaTrackGroup, ImmutableList.of(trackIndex)));
} else {
// An existing override is being modified.
ArrayList<Integer> trackIndices = new ArrayList<>(override.trackIndices);
......@@ -379,19 +381,20 @@ public class TrackSelectionView extends LinearLayout {
trackIndices.remove((Integer) trackIndex);
if (trackIndices.isEmpty()) {
// The last track has been removed, so remove the whole override.
overrides.remove(trackGroup);
overrides.remove(mediaTrackGroup);
} else {
overrides.put(trackGroup, new TrackSelectionOverride(trackGroup, trackIndices));
overrides.put(mediaTrackGroup, new TrackSelectionOverride(mediaTrackGroup, trackIndices));
}
} else if (!isCurrentlySelected) {
if (isAdaptiveAllowed) {
// Add new track to adaptive override.
trackIndices.add(trackIndex);
overrides.put(trackGroup, new TrackSelectionOverride(trackGroup, trackIndices));
overrides.put(mediaTrackGroup, new TrackSelectionOverride(mediaTrackGroup, trackIndices));
} else {
// Replace existing track in override.
overrides.put(
trackGroup, new TrackSelectionOverride(trackGroup, ImmutableList.of(trackIndex)));
mediaTrackGroup,
new TrackSelectionOverride(mediaTrackGroup, ImmutableList.of(trackIndex)));
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment