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:
parent
926884d2f2
commit
ff46a87d39
@ -1507,29 +1507,15 @@ public class DefaultTrackSelector extends MappingTrackSelector {
|
||||
public final int groupIndex;
|
||||
public final int[] tracks;
|
||||
public final int length;
|
||||
public final int reason;
|
||||
public final int data;
|
||||
|
||||
/**
|
||||
* @param groupIndex The overriding track group index.
|
||||
* @param tracks The overriding track indices within the track group.
|
||||
*/
|
||||
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.tracks = Arrays.copyOf(tracks, tracks.length);
|
||||
this.length = tracks.length;
|
||||
this.reason = reason;
|
||||
this.data = data;
|
||||
Arrays.sort(this.tracks);
|
||||
}
|
||||
|
||||
@ -1538,8 +1524,6 @@ public class DefaultTrackSelector extends MappingTrackSelector {
|
||||
length = in.readByte();
|
||||
tracks = new int[length];
|
||||
in.readIntArray(tracks);
|
||||
reason = in.readInt();
|
||||
data = in.readInt();
|
||||
}
|
||||
|
||||
/** Returns whether this override contains the specified track index. */
|
||||
@ -1554,9 +1538,7 @@ public class DefaultTrackSelector extends MappingTrackSelector {
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 31 * groupIndex + Arrays.hashCode(tracks);
|
||||
hash = 31 * hash + reason;
|
||||
return 31 * hash + data;
|
||||
return 31 * groupIndex + Arrays.hashCode(tracks);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -1568,10 +1550,7 @@ public class DefaultTrackSelector extends MappingTrackSelector {
|
||||
return false;
|
||||
}
|
||||
SelectionOverride other = (SelectionOverride) obj;
|
||||
return groupIndex == other.groupIndex
|
||||
&& Arrays.equals(tracks, other.tracks)
|
||||
&& reason == other.reason
|
||||
&& data == other.data;
|
||||
return groupIndex == other.groupIndex && Arrays.equals(tracks, other.tracks);
|
||||
}
|
||||
|
||||
// Parcelable implementation.
|
||||
@ -1586,8 +1565,6 @@ public class DefaultTrackSelector extends MappingTrackSelector {
|
||||
dest.writeInt(groupIndex);
|
||||
dest.writeInt(tracks.length);
|
||||
dest.writeIntArray(tracks);
|
||||
dest.writeInt(reason);
|
||||
dest.writeInt(data);
|
||||
}
|
||||
|
||||
public static final Parcelable.Creator<SelectionOverride> CREATOR =
|
||||
@ -1731,8 +1708,8 @@ public class DefaultTrackSelector extends MappingTrackSelector {
|
||||
: new ExoTrackSelection.Definition(
|
||||
rendererTrackGroups.get(override.groupIndex),
|
||||
override.tracks,
|
||||
override.reason,
|
||||
override.data);
|
||||
C.SELECTION_REASON_MANUAL,
|
||||
/* data= */ null);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user