public class DefaultLoadErrorHandlingPolicy extends java.lang.Object implements LoadErrorHandlingPolicy
LoadErrorHandlingPolicy.| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_MIN_LOADABLE_RETRY_COUNT
The default minimum number of times to retry loading data prior to propagating the error.
|
static int |
DEFAULT_MIN_LOADABLE_RETRY_COUNT_PROGRESSIVE_LIVE
The default minimum number of times to retry loading prior to failing for progressive live
streams.
|
static long |
DEFAULT_TRACK_BLACKLIST_MS
The default duration for which a track is blacklisted in milliseconds.
|
| Constructor and Description |
|---|
DefaultLoadErrorHandlingPolicy()
Creates an instance with default behavior.
|
DefaultLoadErrorHandlingPolicy(int minimumLoadableRetryCount)
Creates an instance with the given value for
getMinimumLoadableRetryCount(int). |
| Modifier and Type | Method and Description |
|---|---|
long |
getBlacklistDurationMsFor(int dataType,
long loadDurationMs,
java.io.IOException exception,
int errorCount)
Blacklists resources whose load error was an
HttpDataSource.InvalidResponseCodeException with response
code HTTP 404 or 410. |
int |
getMinimumLoadableRetryCount(int dataType)
See
DefaultLoadErrorHandlingPolicy() and DefaultLoadErrorHandlingPolicy(int)
for documentation about the behavior of this method. |
long |
getRetryDelayMsFor(int dataType,
long loadDurationMs,
java.io.IOException exception,
int errorCount)
Retries for any exception that is not a subclass of
ParserException. |
public static final int DEFAULT_MIN_LOADABLE_RETRY_COUNT
public static final int DEFAULT_MIN_LOADABLE_RETRY_COUNT_PROGRESSIVE_LIVE
public static final long DEFAULT_TRACK_BLACKLIST_MS
public DefaultLoadErrorHandlingPolicy()
getMinimumLoadableRetryCount(int) will return DEFAULT_MIN_LOADABLE_RETRY_COUNT_PROGRESSIVE_LIVE for dataType C.DATA_TYPE_MEDIA_PROGRESSIVE_LIVE. For other dataType values, it will return DEFAULT_MIN_LOADABLE_RETRY_COUNT.
public DefaultLoadErrorHandlingPolicy(int minimumLoadableRetryCount)
getMinimumLoadableRetryCount(int).minimumLoadableRetryCount - See getMinimumLoadableRetryCount(int).public long getBlacklistDurationMsFor(int dataType,
long loadDurationMs,
java.io.IOException exception,
int errorCount)
HttpDataSource.InvalidResponseCodeException with response
code HTTP 404 or 410. The duration of the blacklisting is DEFAULT_TRACK_BLACKLIST_MS.getBlacklistDurationMsFor in interface LoadErrorHandlingPolicydataType - One of the C.DATA_TYPE_* constants indicating the type of data to
load.loadDurationMs - The duration in milliseconds of the load up to the point at which the
error occurred, including any previous attempts.exception - The load error.errorCount - The number of errors this load has encountered, including this one.C.TIME_UNSET if the resource should
not be blacklisted.public long getRetryDelayMsFor(int dataType,
long loadDurationMs,
java.io.IOException exception,
int errorCount)
ParserException. The retry delay is
calculated as Math.min((errorCount - 1) * 1000, 5000).getRetryDelayMsFor in interface LoadErrorHandlingPolicydataType - One of the C.DATA_TYPE_* constants indicating the type of data to
load.loadDurationMs - The duration in milliseconds of the load up to the point at which the
error occurred, including any previous attempts.exception - The load error.errorCount - The number of errors this load has encountered, including this one.C.TIME_UNSET if the error is fatal and should not be retried.public int getMinimumLoadableRetryCount(int dataType)
DefaultLoadErrorHandlingPolicy() and DefaultLoadErrorHandlingPolicy(int)
for documentation about the behavior of this method.getMinimumLoadableRetryCount in interface LoadErrorHandlingPolicydataType - One of the C.DATA_TYPE_* constants indicating the type of data to
load.Loader.startLoading(Loadable, Callback, int)