diff --git a/library/core/src/main/java/com/google/android/exoplayer2/trackselection/BaseTrackSelection.java b/library/core/src/main/java/com/google/android/exoplayer2/trackselection/BaseTrackSelection.java index fe08b02a1c..670f319f90 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/trackselection/BaseTrackSelection.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/trackselection/BaseTrackSelection.java @@ -164,7 +164,7 @@ public abstract class BaseTrackSelection implements ExoTrackSelection { } @Override - public final boolean blacklist(int index, long exclusionDurationMs) { + public boolean blacklist(int index, long exclusionDurationMs) { long nowMs = SystemClock.elapsedRealtime(); boolean canExclude = isBlacklisted(index, nowMs); for (int i = 0; i < length && !canExclude; i++) { @@ -180,15 +180,8 @@ public abstract class BaseTrackSelection implements ExoTrackSelection { return true; } - // Internal methods. - - /** - * Returns whether the track at the specified index in the selection is excluded. - * - * @param index The index of the track in the selection. - * @param nowMs The current time in the timebase of {@link SystemClock#elapsedRealtime()}. - */ - protected final boolean isBlacklisted(int index, long nowMs) { + @Override + public boolean isBlacklisted(int index, long nowMs) { return excludeUntilTimes[index] > nowMs; } diff --git a/library/core/src/main/java/com/google/android/exoplayer2/trackselection/ExoTrackSelection.java b/library/core/src/main/java/com/google/android/exoplayer2/trackselection/ExoTrackSelection.java index 1e2b057042..ee1fa2dcfe 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/trackselection/ExoTrackSelection.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/trackselection/ExoTrackSelection.java @@ -271,4 +271,13 @@ public interface ExoTrackSelection extends TrackSelection { * @return Whether exclusion was successful. */ boolean blacklist(int index, long exclusionDurationMs); + + /** + * Returns whether the track at the specified index in the selection is excluded. + * + * @param index The index of the track in the selection. + * @param nowMs The current time in the timebase of {@link + * android.os.SystemClock#elapsedRealtime()}. + */ + boolean isBlacklisted(int index, long nowMs); } diff --git a/testutils/src/main/java/com/google/android/exoplayer2/testutil/FakeTrackSelection.java b/testutils/src/main/java/com/google/android/exoplayer2/testutil/FakeTrackSelection.java index 15e1327bdf..3226603803 100644 --- a/testutils/src/main/java/com/google/android/exoplayer2/testutil/FakeTrackSelection.java +++ b/testutils/src/main/java/com/google/android/exoplayer2/testutil/FakeTrackSelection.java @@ -150,4 +150,10 @@ public final class FakeTrackSelection implements ExoTrackSelection { assertThat(isEnabled).isTrue(); return false; } + + @Override + public boolean isBlacklisted(int index, long exclusionDurationMs) { + assertThat(isEnabled).isTrue(); + return false; + } }