Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
SDK
/
exoplayer
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
452f68fb
authored
Oct 20, 2020
by
Oliver Woodman
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Merge pull request #7867 from GeneticGenesis:pc/update-expected-http-statuses-for-failover
PiperOrigin-RevId: 338051017
parent
d2fb9dda
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
42 additions
and
21 deletions
RELEASENOTES.md
library/core/src/main/java/com/google/android/exoplayer2/upstream/DefaultLoadErrorHandlingPolicy.java
library/core/src/test/java/com/google/android/exoplayer2/upstream/DefaultLoadErrorHandlingPolicyTest.java
RELEASENOTES.md
View file @
452f68fb
...
@@ -51,6 +51,9 @@
...
@@ -51,6 +51,9 @@
(
[
#8005
](
https://github.com/google/ExoPlayer/issues/8005
)
).
(
[
#8005
](
https://github.com/google/ExoPlayer/issues/8005
)
).
*
Make FLV files seekable by using the key frame index
*
Make FLV files seekable by using the key frame index
(
[
#7378
](
https://github.com/google/ExoPlayer/issues/7378
)
).
(
[
#7378
](
https://github.com/google/ExoPlayer/issues/7378
)
).
*
Adaptive playback (DASH / HLS / SmoothStreaming):
*
Add 403, 500 and 503 to the list of HTTP status codes that can trigger
failover to another quality variant.
*
HLS:
*
HLS:
*
Fix crash affecting chunkful preparation of master playlists that start
*
Fix crash affecting chunkful preparation of master playlists that start
with an I-FRAME only variant
with an I-FRAME only variant
...
...
library/core/src/main/java/com/google/android/exoplayer2/upstream/DefaultLoadErrorHandlingPolicy.java
View file @
452f68fb
...
@@ -72,9 +72,12 @@ public class DefaultLoadErrorHandlingPolicy implements LoadErrorHandlingPolicy {
...
@@ -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
;
}
}
...
...
library/core/src/test/java/com/google/android/exoplayer2/upstream/DefaultLoadErrorHandlingPolicyTest.java
View file @
452f68fb
...
@@ -48,40 +48,45 @@ public final class DefaultLoadErrorHandlingPolicyTest {
...
@@ -48,40 +48,45 @@ public final class DefaultLoadErrorHandlingPolicyTest {
new
MediaLoadData
(
/* dataType= */
C
.
DATA_TYPE_UNKNOWN
);
new
MediaLoadData
(
/* dataType= */
C
.
DATA_TYPE_UNKNOWN
);
@Test
@Test
public
void
getExclusionDurationMsFor_responseCode403
()
{
InvalidResponseCodeException
exception
=
buildInvalidResponseCodeException
(
403
,
"Forbidden"
);
assertThat
(
getDefaultPolicyExclusionDurationMsFor
(
exception
))
.
isEqualTo
(
DefaultLoadErrorHandlingPolicy
.
DEFAULT_TRACK_BLACKLIST_MS
);
}
@Test
public
void
getExclusionDurationMsFor_responseCode404
()
{
public
void
getExclusionDurationMsFor_responseCode404
()
{
InvalidResponseCodeException
exception
=
InvalidResponseCodeException
exception
=
buildInvalidResponseCodeException
(
404
,
"Not found"
);
new
InvalidResponseCodeException
(
404
,
"Not Found"
,
Collections
.
emptyMap
(),
new
DataSpec
(
Uri
.
EMPTY
),
/* responseBody= */
Util
.
EMPTY_BYTE_ARRAY
);
assertThat
(
getDefaultPolicyExclusionDurationMsFor
(
exception
))
assertThat
(
getDefaultPolicyExclusionDurationMsFor
(
exception
))
.
isEqualTo
(
DefaultLoadErrorHandlingPolicy
.
DEFAULT_TRACK_BLACKLIST_MS
);
.
isEqualTo
(
DefaultLoadErrorHandlingPolicy
.
DEFAULT_TRACK_BLACKLIST_MS
);
}
}
@Test
@Test
public
void
getExclusionDurationMsFor_responseCode410
()
{
public
void
getExclusionDurationMsFor_responseCode410
()
{
InvalidResponseCodeException
exception
=
buildInvalidResponseCodeException
(
410
,
"Gone"
);
assertThat
(
getDefaultPolicyExclusionDurationMsFor
(
exception
))
.
isEqualTo
(
DefaultLoadErrorHandlingPolicy
.
DEFAULT_TRACK_BLACKLIST_MS
);
}
@Test
public
void
getExclusionDurationMsFor_responseCode500
()
{
InvalidResponseCodeException
exception
=
InvalidResponseCodeException
exception
=
new
InvalidResponseCodeException
(
buildInvalidResponseCodeException
(
500
,
"Internal server error"
);
410
,
"Gone"
,
Collections
.
emptyMap
(),
new
DataSpec
(
Uri
.
EMPTY
),
/* responseBody= */
Util
.
EMPTY_BYTE_ARRAY
);
assertThat
(
getDefaultPolicyExclusionDurationMsFor
(
exception
))
assertThat
(
getDefaultPolicyExclusionDurationMsFor
(
exception
))
.
isEqualTo
(
DefaultLoadErrorHandlingPolicy
.
DEFAULT_TRACK_BLACKLIST_MS
);
.
isEqualTo
(
DefaultLoadErrorHandlingPolicy
.
DEFAULT_TRACK_BLACKLIST_MS
);
}
}
@Test
@Test
public
void
getExclusionDurationMsFor_
dontExcludeUnexpectedHttpCodes
()
{
public
void
getExclusionDurationMsFor_
responseCode503
()
{
InvalidResponseCodeException
exception
=
InvalidResponseCodeException
exception
=
new
InvalidResponseCodeException
(
buildInvalidResponseCodeException
(
503
,
"Service unavailable"
);
500
,
assertThat
(
getDefaultPolicyExclusionDurationMsFor
(
exception
))
"Internal Server Error"
,
.
isEqualTo
(
DefaultLoadErrorHandlingPolicy
.
DEFAULT_TRACK_BLACKLIST_MS
);
Collections
.
emptyMap
(),
}
new
DataSpec
(
Uri
.
EMPTY
),
/* responseBody= */
Util
.
EMPTY_BYTE_ARRAY
);
@Test
public
void
getExclusionDurationMsFor_dontExcludeUnexpectedHttpCodes
()
{
InvalidResponseCodeException
exception
=
buildInvalidResponseCodeException
(
418
,
"I'm a teapot"
);
assertThat
(
getDefaultPolicyExclusionDurationMsFor
(
exception
)).
isEqualTo
(
C
.
TIME_UNSET
);
assertThat
(
getDefaultPolicyExclusionDurationMsFor
(
exception
)).
isEqualTo
(
C
.
TIME_UNSET
);
}
}
...
@@ -120,4 +125,14 @@ public final class DefaultLoadErrorHandlingPolicyTest {
...
@@ -120,4 +125,14 @@ public final class DefaultLoadErrorHandlingPolicyTest {
PLACEHOLDER_LOAD_EVENT_INFO
,
PLACEHOLDER_MEDIA_LOAD_DATA
,
exception
,
errorCount
);
PLACEHOLDER_LOAD_EVENT_INFO
,
PLACEHOLDER_MEDIA_LOAD_DATA
,
exception
,
errorCount
);
return
new
DefaultLoadErrorHandlingPolicy
().
getRetryDelayMsFor
(
loadErrorInfo
);
return
new
DefaultLoadErrorHandlingPolicy
().
getRetryDelayMsFor
(
loadErrorInfo
);
}
}
private
static
InvalidResponseCodeException
buildInvalidResponseCodeException
(
int
statusCode
,
String
message
)
{
return
new
InvalidResponseCodeException
(
statusCode
,
message
,
Collections
.
emptyMap
(),
new
DataSpec
(
Uri
.
EMPTY
),
/* responseBody= */
Util
.
EMPTY_BYTE_ARRAY
);
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment