Skip to content

Commit bca1618

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 ed56ed2 commit bca1618

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

RELEASENOTES.md

+2
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@
6161
* Cronet extension:
6262
* RTMP extension:
6363
* HLS extension:
64+
* Prevent excessive reloads by waiting for half the part target duration
65+
when `CAN-BLOCK-RELOAD=YES` is not honored.
6466
* DASH extension:
6567
* Smooth Streaming extension:
6668
* RTSP extension:

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

+7
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)