Remove track selection override reason and data

These have limited value, and are confusing because they're only
actually used if the override only selects a single track (if the
override is an adaptive selection then the values are never used).
The simpliest path forward is to remove them.

PiperOrigin-RevId: 357573186
This commit is contained in:
olly 2021-02-15 15:44:30 +00:00 committed by kim-vde
parent 926884d2f2
commit ff46a87d39

View File

@ -1507,29 +1507,15 @@ public class DefaultTrackSelector extends MappingTrackSelector {
public final int groupIndex; public final int groupIndex;
public final int[] tracks; public final int[] tracks;
public final int length; public final int length;
public final int reason;
public final int data;
/** /**
* @param groupIndex The overriding track group index. * @param groupIndex The overriding track group index.
* @param tracks The overriding track indices within the track group. * @param tracks The overriding track indices within the track group.
*/ */
public SelectionOverride(int groupIndex, int... tracks) { public SelectionOverride(int groupIndex, int... tracks) {
this(groupIndex, tracks, C.SELECTION_REASON_MANUAL, /* data= */ 0);
}
/**
* @param groupIndex The overriding track group index.
* @param tracks The overriding track indices within the track group.
* @param reason The reason for the override. One of the {@link C} SELECTION_REASON_ constants.
* @param data Optional data associated with this override.
*/
public SelectionOverride(int groupIndex, int[] tracks, int reason, int data) {
this.groupIndex = groupIndex; this.groupIndex = groupIndex;
this.tracks = Arrays.copyOf(tracks, tracks.length); this.tracks = Arrays.copyOf(tracks, tracks.length);
this.length = tracks.length; this.length = tracks.length;
this.reason = reason;
this.data = data;
Arrays.sort(this.tracks); Arrays.sort(this.tracks);
} }
@ -1538,8 +1524,6 @@ public class DefaultTrackSelector extends MappingTrackSelector {
length = in.readByte(); length = in.readByte();
tracks = new int[length]; tracks = new int[length];
in.readIntArray(tracks); in.readIntArray(tracks);
reason = in.readInt();
data = in.readInt();
} }
/** Returns whether this override contains the specified track index. */ /** Returns whether this override contains the specified track index. */
@ -1554,9 +1538,7 @@ public class DefaultTrackSelector extends MappingTrackSelector {
@Override @Override
public int hashCode() { public int hashCode() {
int hash = 31 * groupIndex + Arrays.hashCode(tracks); return 31 * groupIndex + Arrays.hashCode(tracks);
hash = 31 * hash + reason;
return 31 * hash + data;
} }
@Override @Override
@ -1568,10 +1550,7 @@ public class DefaultTrackSelector extends MappingTrackSelector {
return false; return false;
} }
SelectionOverride other = (SelectionOverride) obj; SelectionOverride other = (SelectionOverride) obj;
return groupIndex == other.groupIndex return groupIndex == other.groupIndex && Arrays.equals(tracks, other.tracks);
&& Arrays.equals(tracks, other.tracks)
&& reason == other.reason
&& data == other.data;
} }
// Parcelable implementation. // Parcelable implementation.
@ -1586,8 +1565,6 @@ public class DefaultTrackSelector extends MappingTrackSelector {
dest.writeInt(groupIndex); dest.writeInt(groupIndex);
dest.writeInt(tracks.length); dest.writeInt(tracks.length);
dest.writeIntArray(tracks); dest.writeIntArray(tracks);
dest.writeInt(reason);
dest.writeInt(data);
} }
public static final Parcelable.Creator<SelectionOverride> CREATOR = public static final Parcelable.Creator<SelectionOverride> CREATOR =
@ -1731,8 +1708,8 @@ public class DefaultTrackSelector extends MappingTrackSelector {
: new ExoTrackSelection.Definition( : new ExoTrackSelection.Definition(
rendererTrackGroups.get(override.groupIndex), rendererTrackGroups.get(override.groupIndex),
override.tracks, override.tracks,
override.reason, C.SELECTION_REASON_MANUAL,
override.data); /* data= */ null);
} }
} }