Commit 2c042844 by tonihei Committed by Rohit Singh

Rename ExoTrackSelection.blacklist to excludeTrack

It is not possible to provide a safe deprecation path because
BaseTrackSelection can't easily know which of the methods is
implemented by subclasses.

PiperOrigin-RevId: 523471578
parent 81d9c6c1
......@@ -595,13 +595,13 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
}
@Override
public boolean blacklist(int index, long exclusionDurationMs) {
return trackSelection.blacklist(index, exclusionDurationMs);
public boolean excludeTrack(int index, long exclusionDurationMs) {
return trackSelection.excludeTrack(index, exclusionDurationMs);
}
@Override
public boolean isBlacklisted(int index, long nowMs) {
return trackSelection.isBlacklisted(index, nowMs);
public boolean isTrackExcluded(int index, long nowMs) {
return trackSelection.isTrackExcluded(index, nowMs);
}
@Override
......
......@@ -455,7 +455,7 @@ public class AdaptiveTrackSelection extends BaseTrackSelection {
previousReason = Iterables.getLast(queue).trackSelectionReason;
}
int newSelectedIndex = determineIdealSelectedIndex(nowMs, chunkDurationUs);
if (!isBlacklisted(previousSelectedIndex, nowMs)) {
if (!isTrackExcluded(previousSelectedIndex, nowMs)) {
// Revert back to the previous selection if conditions are not suitable for switching.
Format currentFormat = getFormat(previousSelectedIndex);
Format selectedFormat = getFormat(newSelectedIndex);
......@@ -590,7 +590,7 @@ public class AdaptiveTrackSelection extends BaseTrackSelection {
long effectiveBitrate = getAllocatedBandwidth(chunkDurationUs);
int lowestBitrateAllowedIndex = 0;
for (int i = 0; i < length; i++) {
if (nowMs == Long.MIN_VALUE || !isBlacklisted(i, nowMs)) {
if (nowMs == Long.MIN_VALUE || !isTrackExcluded(i, nowMs)) {
Format format = getFormat(i);
if (canSelectFormat(format, format.bitrate, effectiveBitrate)) {
return i;
......
......@@ -164,11 +164,11 @@ public abstract class BaseTrackSelection implements ExoTrackSelection {
}
@Override
public boolean blacklist(int index, long exclusionDurationMs) {
public boolean excludeTrack(int index, long exclusionDurationMs) {
long nowMs = SystemClock.elapsedRealtime();
boolean canExclude = isBlacklisted(index, nowMs);
boolean canExclude = isTrackExcluded(index, nowMs);
for (int i = 0; i < length && !canExclude; i++) {
canExclude = i != index && !isBlacklisted(i, nowMs);
canExclude = i != index && !isTrackExcluded(i, nowMs);
}
if (!canExclude) {
return false;
......@@ -181,7 +181,7 @@ public abstract class BaseTrackSelection implements ExoTrackSelection {
}
@Override
public boolean isBlacklisted(int index, long nowMs) {
public boolean isTrackExcluded(int index, long nowMs) {
return excludeUntilTimes[index] > nowMs;
}
......
......@@ -278,7 +278,7 @@ public interface ExoTrackSelection extends TrackSelection {
* milliseconds.
* @return Whether exclusion was successful.
*/
boolean blacklist(int index, long exclusionDurationMs);
boolean excludeTrack(int index, long exclusionDurationMs);
/**
* Returns whether the track at the specified index in the selection is excluded.
......@@ -287,5 +287,5 @@ public interface ExoTrackSelection extends TrackSelection {
* @param nowMs The current time in the timebase of {@link
* android.os.SystemClock#elapsedRealtime()}.
*/
boolean isBlacklisted(int index, long nowMs);
boolean isTrackExcluded(int index, long nowMs);
}
......@@ -91,7 +91,7 @@ public final class RandomTrackSelection extends BaseTrackSelection {
long nowMs = SystemClock.elapsedRealtime();
int allowedFormatCount = 0;
for (int i = 0; i < length; i++) {
if (!isBlacklisted(i, nowMs)) {
if (!isTrackExcluded(i, nowMs)) {
allowedFormatCount++;
}
}
......@@ -101,7 +101,7 @@ public final class RandomTrackSelection extends BaseTrackSelection {
// Adjust the format index to account for excluded formats.
allowedFormatCount = 0;
for (int i = 0; i < length; i++) {
if (!isBlacklisted(i, nowMs) && selectedIndex == allowedFormatCount++) {
if (!isTrackExcluded(i, nowMs) && selectedIndex == allowedFormatCount++) {
selectedIndex = i;
return;
}
......
......@@ -121,7 +121,7 @@ public final class TrackSelectionUtil {
int numberOfTracks = trackSelection.length();
int numberOfExcludedTracks = 0;
for (int i = 0; i < numberOfTracks; i++) {
if (trackSelection.isBlacklisted(i, nowMs)) {
if (trackSelection.isTrackExcluded(i, nowMs)) {
numberOfExcludedTracks++;
}
}
......
......@@ -530,7 +530,7 @@ public class DefaultDashChunkSource implements DashChunkSource {
boolean cancelLoad = false;
if (fallbackSelection.type == LoadErrorHandlingPolicy.FALLBACK_TYPE_TRACK) {
cancelLoad =
trackSelection.blacklist(
trackSelection.excludeTrack(
trackSelection.indexOf(chunk.trackFormat), fallbackSelection.exclusionDurationMs);
} else if (fallbackSelection.type == LoadErrorHandlingPolicy.FALLBACK_TYPE_LOCATION) {
baseUrlExclusionList.exclude(
......@@ -558,7 +558,7 @@ public class DefaultDashChunkSource implements DashChunkSource {
int numberOfTracks = trackSelection.length();
int numberOfExcludedTracks = 0;
for (int i = 0; i < numberOfTracks; i++) {
if (trackSelection.isBlacklisted(i, nowMs)) {
if (trackSelection.isTrackExcluded(i, nowMs)) {
numberOfExcludedTracks++;
}
}
......
......@@ -573,7 +573,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
* @return Whether the exclusion succeeded.
*/
public boolean maybeExcludeTrack(Chunk chunk, long exclusionDurationMs) {
return trackSelection.blacklist(
return trackSelection.excludeTrack(
trackSelection.indexOf(trackGroup.indexOf(chunk.trackFormat)), exclusionDurationMs);
}
......@@ -602,7 +602,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
}
seenExpectedPlaylistError |= playlistUrl.equals(expectedPlaylistUrl);
return exclusionDurationMs == C.TIME_UNSET
|| (trackSelection.blacklist(trackSelectionIndex, exclusionDurationMs)
|| (trackSelection.excludeTrack(trackSelectionIndex, exclusionDurationMs)
&& playlistTracker.excludeMediaPlaylist(playlistUrl, exclusionDurationMs));
}
......@@ -894,12 +894,12 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
List<? extends MediaChunk> queue,
MediaChunkIterator[] mediaChunkIterators) {
long nowMs = SystemClock.elapsedRealtime();
if (!isBlacklisted(selectedIndex, nowMs)) {
if (!isTrackExcluded(selectedIndex, nowMs)) {
return;
}
// Try from lowest bitrate to highest.
for (int i = length - 1; i >= 0; i--) {
if (!isBlacklisted(i, nowMs)) {
if (!isTrackExcluded(i, nowMs)) {
selectedIndex = i;
return;
}
......
......@@ -297,7 +297,7 @@ public class DefaultSsChunkSource implements SsChunkSource {
return cancelable
&& fallbackSelection != null
&& fallbackSelection.type == LoadErrorHandlingPolicy.FALLBACK_TYPE_TRACK
&& trackSelection.blacklist(
&& trackSelection.excludeTrack(
trackSelection.indexOf(chunk.trackFormat), fallbackSelection.exclusionDurationMs);
}
......
......@@ -146,13 +146,13 @@ public final class FakeTrackSelection implements ExoTrackSelection {
}
@Override
public boolean blacklist(int index, long exclusionDurationMs) {
public boolean excludeTrack(int index, long exclusionDurationMs) {
assertThat(isEnabled).isTrue();
return false;
}
@Override
public boolean isBlacklisted(int index, long nowMs) {
public boolean isTrackExcluded(int index, long nowMs) {
assertThat(isEnabled).isTrue();
return false;
}
......
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