mirror of
https://github.com/androidx/media.git
synced 2025-05-04 22:20:47 +08:00
Update HTTP status codes expected in failover scenarios.
This commit is contained in:
parent
04f67e4adc
commit
1a63f9e3d2
@ -72,9 +72,12 @@ public class DefaultLoadErrorHandlingPolicy implements LoadErrorHandlingPolicy {
|
|||||||
IOException exception = loadErrorInfo.exception;
|
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 == 403 // HTTP 403 Forbidden.
|
||||||
|
|| responseCode == 404 // HTTP 404 Not Found.
|
||||||
|| responseCode == 410 // HTTP 410 Gone.
|
|| responseCode == 410 // HTTP 410 Gone.
|
||||||
|| responseCode == 416 // HTTP 416 Range Not Satisfiable.
|
|| responseCode == 416 // HTTP 416 Range Not Satisfiable.
|
||||||
|
|| responseCode == 500 // HTTP 500 Internal Server Error.
|
||||||
|
|| responseCode == 503 // HTTP 503 Service Unavailable.
|
||||||
? DEFAULT_TRACK_BLACKLIST_MS
|
? DEFAULT_TRACK_BLACKLIST_MS
|
||||||
: C.TIME_UNSET;
|
: C.TIME_UNSET;
|
||||||
}
|
}
|
||||||
|
@ -77,8 +77,8 @@ public final class DefaultLoadErrorHandlingPolicyTest {
|
|||||||
public void getExclusionDurationMsFor_dontExcludeUnexpectedHttpCodes() {
|
public void getExclusionDurationMsFor_dontExcludeUnexpectedHttpCodes() {
|
||||||
InvalidResponseCodeException exception =
|
InvalidResponseCodeException exception =
|
||||||
new InvalidResponseCodeException(
|
new InvalidResponseCodeException(
|
||||||
500,
|
418,
|
||||||
"Internal Server Error",
|
"I'm a teapot",
|
||||||
Collections.emptyMap(),
|
Collections.emptyMap(),
|
||||||
new DataSpec(Uri.EMPTY),
|
new DataSpec(Uri.EMPTY),
|
||||||
/* responseBody= */ Util.EMPTY_BYTE_ARRAY);
|
/* responseBody= */ Util.EMPTY_BYTE_ARRAY);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user