Skip to content

Commit bbe8200

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 83efd8e commit bbe8200

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
@@ -80,6 +80,8 @@
8080
* Cronet extension:
8181
* RTMP extension:
8282
* HLS extension:
83+
* Prevent excessive reloads by waiting for half the part target duration
84+
when `CAN-BLOCK-RELOAD=YES` is not honored.
8385
* DASH extension:
8486
* Smooth Streaming extension:
8587
* 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)