mirror of
https://github.com/samsonjs/media.git
synced 2026-04-27 15:07:40 +00:00
Add isBlacklisted method to ExoTrackSelection interface.
Make BaseTrackSelection blacklist and isBlacklisted methods non-final. PiperOrigin-RevId: 366256521
This commit is contained in:
parent
b4aee72a4a
commit
1242237294
3 changed files with 18 additions and 10 deletions
|
|
@ -164,7 +164,7 @@ public abstract class BaseTrackSelection implements ExoTrackSelection {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final boolean blacklist(int index, long exclusionDurationMs) {
|
public boolean blacklist(int index, long exclusionDurationMs) {
|
||||||
long nowMs = SystemClock.elapsedRealtime();
|
long nowMs = SystemClock.elapsedRealtime();
|
||||||
boolean canExclude = isBlacklisted(index, nowMs);
|
boolean canExclude = isBlacklisted(index, nowMs);
|
||||||
for (int i = 0; i < length && !canExclude; i++) {
|
for (int i = 0; i < length && !canExclude; i++) {
|
||||||
|
|
@ -180,15 +180,8 @@ public abstract class BaseTrackSelection implements ExoTrackSelection {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Internal methods.
|
@Override
|
||||||
|
public boolean isBlacklisted(int index, long nowMs) {
|
||||||
/**
|
|
||||||
* 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) {
|
|
||||||
return excludeUntilTimes[index] > nowMs;
|
return excludeUntilTimes[index] > nowMs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -271,4 +271,13 @@ public interface ExoTrackSelection extends TrackSelection {
|
||||||
* @return Whether exclusion was successful.
|
* @return Whether exclusion was successful.
|
||||||
*/
|
*/
|
||||||
boolean blacklist(int index, long exclusionDurationMs);
|
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);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -150,4 +150,10 @@ public final class FakeTrackSelection implements ExoTrackSelection {
|
||||||
assertThat(isEnabled).isTrue();
|
assertThat(isEnabled).isTrue();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isBlacklisted(int index, long exclusionDurationMs) {
|
||||||
|
assertThat(isEnabled).isTrue();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue