private static int[] getTracksRemoving(SelectionOverride override, int removedTrack) { int[] tracks = new int[override.length - 1]; int trackCount = 0; for (int i = 0; i < tracks.length + 1; i++) { int track = override.tracks[i]; if (track != removedTrack) { tracks[trackCount++] = track; } } return tracks; }
private void setOverride(int group, int[] tracks, boolean enableRandomAdaptation) { TrackSelection.Factory factory = tracks.length == 1 ? FIXED_FACTORY : (enableRandomAdaptation ? RANDOM_FACTORY : adaptiveVideoTrackSelectionFactory); override = new SelectionOverride(factory, group, tracks); }
private static int[] getTracksAdding(SelectionOverride override, int addedTrack) { int[] tracks = override.tracks; tracks = Arrays.copyOf(tracks, tracks.length + 1); tracks[tracks.length - 1] = addedTrack; return tracks; }
private void setOverride(int group, int[] tracks, boolean enableRandomAdaptation) { TrackSelection.Factory factory = tracks.length == 1 ? FIXED_FACTORY : (enableRandomAdaptation ? RANDOM_FACTORY : adaptiveTrackSelectionFactory); override = new SelectionOverride(factory, group, tracks); }