Fix HLS endless retrying on load errors

This was originally reported on #9390. There was a bug that when HLS
loads failed, the player would endlessly retry and never fail with a
player error.

This change fixes a bug in HlsSampleStreamWrapper.onPlaylistError()
which would return true for a playlist whose load encountered an error
but could not be excluded, whereas the method should return false.

Issue: #9390

#minor-release

PiperOrigin-RevId: 397045802
This commit is contained in:
christosts 2021-09-16 11:55:10 +01:00 committed by Christos Tsilopoulos
parent f5498ec4bf
commit 78fc27a1c6
2 changed files with 16 additions and 1 deletions

View File

@ -56,6 +56,10 @@
([#9370](https://github.com/google/ExoPlayer/issues/9370)). ([#9370](https://github.com/google/ExoPlayer/issues/9370)).
* Fix base URL selection and load error handling when base URLs are shared * Fix base URL selection and load error handling when base URLs are shared
across adaptation sets. across adaptation sets.
* HLS
* Fix bug where the player would get stuck if all download attempts fail
and would not raise an error to the application.
([#9390](https://github.com/google/ExoPlayer/issues/9390)).
* Remove deprecated symbols: * Remove deprecated symbols:
* Remove `Renderer.VIDEO_SCALING_MODE_*` constants. Use identically named * Remove `Renderer.VIDEO_SCALING_MODE_*` constants. Use identically named
constants in `C` instead. constants in `C` instead.

View File

@ -555,6 +555,14 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
chunkSource.setIsTimestampMaster(isTimestampMaster); chunkSource.setIsTimestampMaster(isTimestampMaster);
} }
/**
* Called if an error is encountered while loading a playlist.
*
* @param playlistUrl The {@link Uri} of the playlist whose load encountered an error.
* @param loadErrorInfo The load error info.
* @param forceRetry Whether retry should be forced without considering exclusion.
* @return True if excluding did not encounter errors. False otherwise.
*/
public boolean onPlaylistError(Uri playlistUrl, LoadErrorInfo loadErrorInfo, boolean forceRetry) { public boolean onPlaylistError(Uri playlistUrl, LoadErrorInfo loadErrorInfo, boolean forceRetry) {
if (!chunkSource.obtainsChunksForPlaylist(playlistUrl)) { if (!chunkSource.obtainsChunksForPlaylist(playlistUrl)) {
// Return early if the chunk source doesn't deliver chunks for the failing playlist. // Return early if the chunk source doesn't deliver chunks for the failing playlist.
@ -571,7 +579,10 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
exclusionDurationMs = fallbackSelection.exclusionDurationMs; exclusionDurationMs = fallbackSelection.exclusionDurationMs;
} }
} }
return chunkSource.onPlaylistError(playlistUrl, exclusionDurationMs); // We must call ChunkSource.onPlaylistError in any case to give the chunk source the chance to
// mark the playlist as failing.
return chunkSource.onPlaylistError(playlistUrl, exclusionDurationMs)
&& exclusionDurationMs != C.TIME_UNSET;
} }
// SampleStream implementation. // SampleStream implementation.