Skip to content

Commit 9d3b586

Browse files
authored
fix: Add a small fudge to prefetch eviction (#8470)
This will prevent duplicate segments from being downloaded when we are close to the live edge.
1 parent 3e8c00d commit 9d3b586

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/media/streaming_engine.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1562,7 +1562,10 @@ shaka.media.StreamingEngine = class {
15621562

15631563
if (mediaState.segmentPrefetch && mediaState.segmentIterator &&
15641564
!this.audioPrefetchMap_.has(mediaState.stream)) {
1565-
mediaState.segmentPrefetch.evict(reference.startTime);
1565+
// This will prevent duplicate segments from being downloaded when we
1566+
// are close to the live edge.
1567+
const fudgeTime = 0.001;
1568+
mediaState.segmentPrefetch.evict(reference.startTime + fudgeTime);
15661569
mediaState.segmentPrefetch.prefetchSegmentsByTime(reference.startTime)
15671570
// We're treating this call as sync here, so ignore async errors
15681571
// to not propagate them further.

0 commit comments

Comments
 (0)