mirror of
https://github.com/samsonjs/media.git
synced 2026-04-27 15:07:40 +00:00
Use overflow-save add operation for blacklisting duration.
This allows to specify open-ended blacklisting with Long.MAX_VALUE. PiperOrigin-RevId: 222550939
This commit is contained in:
parent
56e4860cb0
commit
f8a3c135e5
2 changed files with 5 additions and 2 deletions
|
|
@ -70,7 +70,6 @@ import java.util.List;
|
|||
.setMimeType(MIME_TYPE_VIDEO_MP4)
|
||||
.setMedia("https://html5demos.com/assets/dizzy.mp4")
|
||||
.buildAndClear());
|
||||
|
||||
SAMPLES = Collections.unmodifiableList(samples);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ import com.google.android.exoplayer2.Format;
|
|||
import com.google.android.exoplayer2.source.TrackGroup;
|
||||
import com.google.android.exoplayer2.source.chunk.MediaChunk;
|
||||
import com.google.android.exoplayer2.util.Assertions;
|
||||
import com.google.android.exoplayer2.util.Util;
|
||||
import java.util.Arrays;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
|
@ -160,7 +161,10 @@ public abstract class BaseTrackSelection implements TrackSelection {
|
|||
if (!canBlacklist) {
|
||||
return false;
|
||||
}
|
||||
blacklistUntilTimes[index] = Math.max(blacklistUntilTimes[index], nowMs + blacklistDurationMs);
|
||||
blacklistUntilTimes[index] =
|
||||
Math.max(
|
||||
blacklistUntilTimes[index],
|
||||
Util.addWithOverflowDefault(nowMs, blacklistDurationMs, Long.MAX_VALUE));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue