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
This commit is contained in:
parent
baf1aa1cdb
commit
7ee53219ff
@ -28,6 +28,8 @@
|
||||
instead. Note that even for the deprecated variants, the offset is not
|
||||
anymore added to `startTimeUs` and `endTimeUs` of the `MediaLoadData`
|
||||
objects that are dispatched by the dispatcher.
|
||||
* Rename `ExoTrackSelection.blacklist` to `excludeTrack` and
|
||||
`isBlacklisted` to `isTrackExcluded`.
|
||||
* Session:
|
||||
* Fix bug where multiple identical queue items published by a legacy
|
||||
`MediaSessionCompat` result in an exception in `MediaController`
|
||||
|
@ -596,13 +596,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
|
||||
|
@ -457,7 +457,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);
|
||||
@ -592,7 +592,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;
|
||||
|
@ -166,11 +166,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;
|
||||
@ -183,7 +183,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;
|
||||
}
|
||||
|
||||
|
@ -280,7 +280,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.
|
||||
@ -289,5 +289,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);
|
||||
}
|
||||
|
@ -93,7 +93,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++;
|
||||
}
|
||||
}
|
||||
@ -103,7 +103,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;
|
||||
}
|
||||
|
@ -123,7 +123,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++;
|
||||
}
|
||||
}
|
||||
|
@ -532,7 +532,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(
|
||||
@ -560,7 +560,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;
|
||||
}
|
||||
|
@ -299,7 +299,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);
|
||||
}
|
||||
|
||||
|
@ -148,13 +148,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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user