Commit ba33f604 by aquilescanta Committed by Oliver Woodman

Deprecate LoadErrorHandlingPolicy methods without loadTaskId

Issue: #7309
PiperOrigin-RevId: 312115330
parent cccb9e1a
...@@ -26,6 +26,11 @@ ...@@ -26,6 +26,11 @@
average video frame processing offset. average video frame processing offset.
* Add playlist API * Add playlist API
([#6161](https://github.com/google/ExoPlayer/issues/6161)). ([#6161](https://github.com/google/ExoPlayer/issues/6161)).
* Attach an identifier and extra information to load error events passed
to `LoadErrorHandlingPolicy`. `LoadErrorHandlingPolicy` implementations
must migrate to overriding the non-deprecated methods of the interface
in preparation for deprecated methods' removal in a future ExoPlayer
version ([#7309](https://github.com/google/ExoPlayer/issues/7309)).
* Add `play` and `pause` methods to `Player`. * Add `play` and `pause` methods to `Player`.
* Add `Player.getCurrentLiveOffset` to conveniently return the live * Add `Player.getCurrentLiveOffset` to conveniently return the live
offset. offset.
......
...@@ -65,8 +65,8 @@ public class DefaultLoadErrorHandlingPolicy implements LoadErrorHandlingPolicy { ...@@ -65,8 +65,8 @@ public class DefaultLoadErrorHandlingPolicy implements LoadErrorHandlingPolicy {
* code HTTP 404 or 410. The duration of the blacklisting is {@link #DEFAULT_TRACK_BLACKLIST_MS}. * code HTTP 404 or 410. The duration of the blacklisting is {@link #DEFAULT_TRACK_BLACKLIST_MS}.
*/ */
@Override @Override
public long getBlacklistDurationMsFor( public long getBlacklistDurationMsFor(LoadErrorInfo loadErrorInfo) {
int dataType, long loadDurationMs, IOException exception, int errorCount) { IOException exception = loadErrorInfo.exception;
if (exception instanceof InvalidResponseCodeException) { if (exception instanceof InvalidResponseCodeException) {
int responseCode = ((InvalidResponseCodeException) exception).responseCode; int responseCode = ((InvalidResponseCodeException) exception).responseCode;
return responseCode == 404 // HTTP 404 Not Found. return responseCode == 404 // HTTP 404 Not Found.
...@@ -84,13 +84,13 @@ public class DefaultLoadErrorHandlingPolicy implements LoadErrorHandlingPolicy { ...@@ -84,13 +84,13 @@ public class DefaultLoadErrorHandlingPolicy implements LoadErrorHandlingPolicy {
* {@code Math.min((errorCount - 1) * 1000, 5000)}. * {@code Math.min((errorCount - 1) * 1000, 5000)}.
*/ */
@Override @Override
public long getRetryDelayMsFor( public long getRetryDelayMsFor(LoadErrorInfo loadErrorInfo) {
int dataType, long loadDurationMs, IOException exception, int errorCount) { IOException exception = loadErrorInfo.exception;
return exception instanceof ParserException return exception instanceof ParserException
|| exception instanceof FileNotFoundException || exception instanceof FileNotFoundException
|| exception instanceof UnexpectedLoaderException || exception instanceof UnexpectedLoaderException
? C.TIME_UNSET ? C.TIME_UNSET
: Math.min((errorCount - 1) * 1000, 5000); : Math.min((loadErrorInfo.errorCount - 1) * 1000, 5000);
} }
/** /**
......
...@@ -65,21 +65,12 @@ public interface LoadErrorHandlingPolicy { ...@@ -65,21 +65,12 @@ public interface LoadErrorHandlingPolicy {
} }
} }
/** /** @deprecated Implement {@link #getBlacklistDurationMsFor(LoadErrorInfo)} instead. */
* Returns the number of milliseconds for which a resource associated to a provided load error @Deprecated
* should be blacklisted, or {@link C#TIME_UNSET} if the resource should not be blacklisted. default long getBlacklistDurationMsFor(
* int dataType, long loadDurationMs, IOException exception, int errorCount) {
* @param dataType One of the {@link C C.DATA_TYPE_*} constants indicating the type of data to throw new UnsupportedOperationException();
* load. }
* @param loadDurationMs The duration in milliseconds of the load from the start of the first load
* attempt up to the point at which the error occurred.
* @param exception The load error.
* @param errorCount The number of errors this load has encountered, including this one.
* @return The blacklist duration in milliseconds, or {@link C#TIME_UNSET} if the resource should
* not be blacklisted.
*/
long getBlacklistDurationMsFor(
int dataType, long loadDurationMs, IOException exception, int errorCount);
/** /**
* Returns the number of milliseconds for which a resource associated to a provided load error * Returns the number of milliseconds for which a resource associated to a provided load error
...@@ -89,6 +80,7 @@ public interface LoadErrorHandlingPolicy { ...@@ -89,6 +80,7 @@ public interface LoadErrorHandlingPolicy {
* @return The blacklist duration in milliseconds, or {@link C#TIME_UNSET} if the resource should * @return The blacklist duration in milliseconds, or {@link C#TIME_UNSET} if the resource should
* not be blacklisted. * not be blacklisted.
*/ */
@SuppressWarnings("deprecation")
default long getBlacklistDurationMsFor(LoadErrorInfo loadErrorInfo) { default long getBlacklistDurationMsFor(LoadErrorInfo loadErrorInfo) {
return getBlacklistDurationMsFor( return getBlacklistDurationMsFor(
loadErrorInfo.mediaLoadData.dataType, loadErrorInfo.mediaLoadData.dataType,
...@@ -97,24 +89,12 @@ public interface LoadErrorHandlingPolicy { ...@@ -97,24 +89,12 @@ public interface LoadErrorHandlingPolicy {
loadErrorInfo.errorCount); loadErrorInfo.errorCount);
} }
/** /** @deprecated Implement {@link #getRetryDelayMsFor(LoadErrorInfo)} instead. */
* Returns the number of milliseconds to wait before attempting the load again, or {@link @Deprecated
* C#TIME_UNSET} if the error is fatal and should not be retried. default long getRetryDelayMsFor(
* int dataType, long loadDurationMs, IOException exception, int errorCount) {
* <p>{@link Loader} clients may ignore the retry delay returned by this method in order to wait throw new UnsupportedOperationException();
* for a specific event before retrying. However, the load is retried if and only if this method }
* does not return {@link C#TIME_UNSET}.
*
* @param dataType One of the {@link C C.DATA_TYPE_*} constants indicating the type of data to
* load.
* @param loadDurationMs The duration in milliseconds of the load from the start of the first load
* attempt up to the point at which the error occurred.
* @param exception The load error.
* @param errorCount The number of errors this load has encountered, including this one.
* @return The number of milliseconds to wait before attempting the load again, or {@link
* C#TIME_UNSET} if the error is fatal and should not be retried.
*/
long getRetryDelayMsFor(int dataType, long loadDurationMs, IOException exception, int errorCount);
/** /**
* Returns the number of milliseconds to wait before attempting the load again, or {@link * Returns the number of milliseconds to wait before attempting the load again, or {@link
...@@ -128,6 +108,7 @@ public interface LoadErrorHandlingPolicy { ...@@ -128,6 +108,7 @@ public interface LoadErrorHandlingPolicy {
* @return The number of milliseconds to wait before attempting the load again, or {@link * @return The number of milliseconds to wait before attempting the load again, or {@link
* C#TIME_UNSET} if the error is fatal and should not be retried. * C#TIME_UNSET} if the error is fatal and should not be retried.
*/ */
@SuppressWarnings("deprecation")
default long getRetryDelayMsFor(LoadErrorInfo loadErrorInfo) { default long getRetryDelayMsFor(LoadErrorInfo loadErrorInfo) {
return getRetryDelayMsFor( return getRetryDelayMsFor(
loadErrorInfo.mediaLoadData.dataType, loadErrorInfo.mediaLoadData.dataType,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment