Skip to content

Commit 758fef9

Browse files
committed
Prevent infinite reloads when CAN-BLOCK-RELOAD=YES is not honored
Waits for half the part target duration before retrying when the server responds with `CAN-BLOCK-RELOAD=YES` but does not actually block until the playlist updates. Prevents excessive requests in such cases.
1 parent c8a3361 commit 758fef9

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

RELEASENOTES.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@
8383
* Fix issue where chunk duration wasn't set in `CmcdData` for HLS media,
8484
causing an assertion failure when processing encrypted media segments
8585
([#2312](https://github.com/androidx/media/issues/2312)).
86+
* Prevent excessive reloads by waiting for half the part target duration
87+
when `CAN-BLOCK-RELOAD=YES` is not honored.
8688
* DASH extension:
8789
* Smooth Streaming extension:
8890
* RTSP extension:

libraries/exoplayer_hls/src/main/java/androidx/media3/exoplayer/hls/playlist/DefaultHlsPlaylistTracker.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -853,6 +853,13 @@ private void processLoadedPlaylist(
853853
playlistSnapshot != oldPlaylist
854854
? playlistSnapshot.targetDurationUs
855855
: (playlistSnapshot.targetDurationUs / 2);
856+
} else if (
857+
playlistSnapshot == oldPlaylist && playlistSnapshot.partTargetDurationUs != C.TIME_UNSET
858+
) {
859+
// To prevent infinite requests when the server responds with CAN-BLOCK-RELOAD=YES but does
860+
// not actually block until the playlist updates, wait for half the part target duration
861+
// before retrying.
862+
durationUntilNextLoadUs = playlistSnapshot.partTargetDurationUs / 2;
856863
}
857864
earliestNextLoadTimeMs =
858865
currentTimeMs + Util.usToMs(durationUntilNextLoadUs) - loadEventInfo.loadDurationMs;

0 commit comments

Comments
 (0)