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
0ee3a35a
authored
Jul 03, 2020
by
kimvde
Committed by
Ian Baker
Jul 06, 2020
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Rename some white/blacklist occurences in HLS library
ISSUE: #7565 PiperOrigin-RevId: 319536055
parent
3d968ddd
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
60 additions
and
60 deletions
library/hls/src/main/java/com/google/android/exoplayer2/source/hls/HlsChunkSource.java
library/hls/src/main/java/com/google/android/exoplayer2/source/hls/HlsMediaPeriod.java
library/hls/src/main/java/com/google/android/exoplayer2/source/hls/HlsSampleStreamWrapper.java
library/hls/src/main/java/com/google/android/exoplayer2/source/hls/playlist/DefaultHlsPlaylistTracker.java
library/hls/src/main/java/com/google/android/exoplayer2/source/hls/playlist/HlsPlaylistTracker.java
library/hls/src/main/java/com/google/android/exoplayer2/source/hls/HlsChunkSource.java
View file @
0ee3a35a
...
...
@@ -371,28 +371,28 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
}
/**
* Attempts to
blacklist the track associated with the given chunk. Blacklisting will fail if the
*
track is the only non-blacklist
ed track in the selection.
* Attempts to
exclude the track associated with the given chunk. Exclusion will fail if the track
*
is the only non-exclud
ed track in the selection.
*
* @param chunk The chunk whose load caused the
blacklisting
attempt.
* @param
blacklist
DurationMs The number of milliseconds for which the track selection should be
*
blacklist
ed.
* @return Whether the
blacklisting
succeeded.
* @param chunk The chunk whose load caused the
exclusion
attempt.
* @param
exclusion
DurationMs The number of milliseconds for which the track selection should be
*
exclud
ed.
* @return Whether the
exclusion
succeeded.
*/
public
boolean
maybe
BlacklistTrack
(
Chunk
chunk
,
long
blacklist
DurationMs
)
{
public
boolean
maybe
ExcludeTrack
(
Chunk
chunk
,
long
exclusion
DurationMs
)
{
return
trackSelection
.
blacklist
(
trackSelection
.
indexOf
(
trackGroup
.
indexOf
(
chunk
.
trackFormat
)),
blacklist
DurationMs
);
trackSelection
.
indexOf
(
trackGroup
.
indexOf
(
chunk
.
trackFormat
)),
exclusion
DurationMs
);
}
/**
* Called when a playlist load encounters an error.
*
* @param playlistUrl The {@link Uri} of the playlist whose load encountered an error.
* @param
blacklistDurationMs The duration for which the playlist should be blacklist
ed. Or {@link
* C#TIME_UNSET} if the playlist should not be
blacklist
ed.
* @return True if
blacklist
ing did not encounter errors. False otherwise.
* @param
exclusionDurationMs The duration for which the playlist should be exclud
ed. Or {@link
* C#TIME_UNSET} if the playlist should not be
exclud
ed.
* @return True if
exclud
ing did not encounter errors. False otherwise.
*/
public
boolean
onPlaylistError
(
Uri
playlistUrl
,
long
blacklist
DurationMs
)
{
public
boolean
onPlaylistError
(
Uri
playlistUrl
,
long
exclusion
DurationMs
)
{
int
trackGroupIndex
=
C
.
INDEX_UNSET
;
for
(
int
i
=
0
;
i
<
playlistUrls
.
length
;
i
++)
{
if
(
playlistUrls
[
i
].
equals
(
playlistUrl
))
{
...
...
@@ -408,8 +408,8 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
return
true
;
}
seenExpectedPlaylistError
|=
playlistUrl
.
equals
(
expectedPlaylistUrl
);
return
blacklist
DurationMs
==
C
.
TIME_UNSET
||
trackSelection
.
blacklist
(
trackSelectionIndex
,
blacklist
DurationMs
);
return
exclusion
DurationMs
==
C
.
TIME_UNSET
||
trackSelection
.
blacklist
(
trackSelectionIndex
,
exclusion
DurationMs
);
}
/**
...
...
library/hls/src/main/java/com/google/android/exoplayer2/source/hls/HlsMediaPeriod.java
View file @
0ee3a35a
...
...
@@ -452,13 +452,13 @@ public final class HlsMediaPeriod implements MediaPeriod, HlsSampleStreamWrapper
}
@Override
public
boolean
onPlaylistError
(
Uri
url
,
long
blacklist
DurationMs
)
{
boolean
noBlacklistingFailure
=
true
;
public
boolean
onPlaylistError
(
Uri
url
,
long
exclusion
DurationMs
)
{
boolean
exclusionSucceeded
=
true
;
for
(
HlsSampleStreamWrapper
streamWrapper
:
sampleStreamWrappers
)
{
noBlacklistingFailure
&=
streamWrapper
.
onPlaylistError
(
url
,
blacklist
DurationMs
);
exclusionSucceeded
&=
streamWrapper
.
onPlaylistError
(
url
,
exclusion
DurationMs
);
}
callback
.
onContinueLoadingRequested
(
this
);
return
noBlacklistingFailure
;
return
exclusionSucceeded
;
}
// Internal methods.
...
...
library/hls/src/main/java/com/google/android/exoplayer2/source/hls/HlsSampleStreamWrapper.java
View file @
0ee3a35a
...
...
@@ -515,8 +515,8 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
chunkSource
.
setIsTimestampMaster
(
isTimestampMaster
);
}
public
boolean
onPlaylistError
(
Uri
playlistUrl
,
long
blacklist
DurationMs
)
{
return
chunkSource
.
onPlaylistError
(
playlistUrl
,
blacklist
DurationMs
);
public
boolean
onPlaylistError
(
Uri
playlistUrl
,
long
exclusion
DurationMs
)
{
return
chunkSource
.
onPlaylistError
(
playlistUrl
,
exclusion
DurationMs
);
}
// SampleStream implementation.
...
...
@@ -793,7 +793,7 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
int
errorCount
)
{
long
bytesLoaded
=
loadable
.
bytesLoaded
();
boolean
isMediaChunk
=
isMediaChunk
(
loadable
);
boolean
blacklist
Succeeded
=
false
;
boolean
exclusion
Succeeded
=
false
;
LoadEventInfo
loadEventInfo
=
new
LoadEventInfo
(
loadable
.
loadTaskId
,
...
...
@@ -815,12 +815,12 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
LoadErrorInfo
loadErrorInfo
=
new
LoadErrorInfo
(
loadEventInfo
,
mediaLoadData
,
error
,
errorCount
);
LoadErrorAction
loadErrorAction
;
long
blacklist
DurationMs
=
loadErrorHandlingPolicy
.
getBlacklistDurationMsFor
(
loadErrorInfo
);
if
(
blacklist
DurationMs
!=
C
.
TIME_UNSET
)
{
blacklistSucceeded
=
chunkSource
.
maybeBlacklistTrack
(
loadable
,
blacklist
DurationMs
);
long
exclusion
DurationMs
=
loadErrorHandlingPolicy
.
getBlacklistDurationMsFor
(
loadErrorInfo
);
if
(
exclusion
DurationMs
!=
C
.
TIME_UNSET
)
{
exclusionSucceeded
=
chunkSource
.
maybeExcludeTrack
(
loadable
,
exclusion
DurationMs
);
}
if
(
blacklist
Succeeded
)
{
if
(
exclusion
Succeeded
)
{
if
(
isMediaChunk
&&
bytesLoaded
==
0
)
{
HlsMediaChunk
removed
=
mediaChunks
.
remove
(
mediaChunks
.
size
()
-
1
);
Assertions
.
checkState
(
removed
==
loadable
);
...
...
@@ -829,7 +829,7 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
}
}
loadErrorAction
=
Loader
.
DONT_RETRY
;
}
else
/* did not
blacklist
*/
{
}
else
/* did not
exclude
*/
{
long
retryDelayMs
=
loadErrorHandlingPolicy
.
getRetryDelayMsFor
(
loadErrorInfo
);
loadErrorAction
=
retryDelayMs
!=
C
.
TIME_UNSET
...
...
@@ -854,7 +854,7 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
loadErrorHandlingPolicy
.
onLoadTaskConcluded
(
loadable
.
loadTaskId
);
}
if
(
blacklist
Succeeded
)
{
if
(
exclusion
Succeeded
)
{
if
(!
prepared
)
{
continueLoading
(
lastSeekPositionUs
);
}
else
{
...
...
library/hls/src/main/java/com/google/android/exoplayer2/source/hls/playlist/DefaultHlsPlaylistTracker.java
View file @
0ee3a35a
...
...
@@ -314,7 +314,7 @@ public final class DefaultHlsPlaylistTracker
long
currentTimeMs
=
SystemClock
.
elapsedRealtime
();
for
(
int
i
=
0
;
i
<
variantsSize
;
i
++)
{
MediaPlaylistBundle
bundle
=
playlistBundles
.
get
(
variants
.
get
(
i
).
url
);
if
(
currentTimeMs
>
bundle
.
blacklist
UntilMs
)
{
if
(
currentTimeMs
>
bundle
.
exclude
UntilMs
)
{
primaryMediaPlaylistUrl
=
bundle
.
playlistUrl
;
bundle
.
loadPlaylist
();
return
true
;
...
...
@@ -377,13 +377,13 @@ public final class DefaultHlsPlaylistTracker
}
}
private
boolean
notifyPlaylistError
(
Uri
playlistUrl
,
long
blacklist
DurationMs
)
{
private
boolean
notifyPlaylistError
(
Uri
playlistUrl
,
long
exclusion
DurationMs
)
{
int
listenersSize
=
listeners
.
size
();
boolean
any
Blacklisting
Failed
=
false
;
boolean
any
Exclusion
Failed
=
false
;
for
(
int
i
=
0
;
i
<
listenersSize
;
i
++)
{
any
BlacklistingFailed
|=
!
listeners
.
get
(
i
).
onPlaylistError
(
playlistUrl
,
blacklist
DurationMs
);
any
ExclusionFailed
|=
!
listeners
.
get
(
i
).
onPlaylistError
(
playlistUrl
,
exclusion
DurationMs
);
}
return
any
Blacklisting
Failed
;
return
any
Exclusion
Failed
;
}
private
HlsMediaPlaylist
getLatestPlaylistSnapshot
(
...
...
@@ -467,7 +467,7 @@ public final class DefaultHlsPlaylistTracker
private
long
lastSnapshotLoadMs
;
private
long
lastSnapshotChangeMs
;
private
long
earliestNextLoadTimeMs
;
private
long
blacklist
UntilMs
;
private
long
exclude
UntilMs
;
private
boolean
loadPending
;
private
IOException
playlistError
;
...
...
@@ -504,7 +504,7 @@ public final class DefaultHlsPlaylistTracker
}
public
void
loadPlaylist
()
{
blacklist
UntilMs
=
0
;
exclude
UntilMs
=
0
;
if
(
loadPending
||
mediaPlaylistLoader
.
isLoading
()
||
mediaPlaylistLoader
.
hasFatalError
())
{
// Load already pending, in progress, or a fatal error has been encountered. Do nothing.
return
;
...
...
@@ -590,16 +590,16 @@ public final class DefaultHlsPlaylistTracker
LoadErrorInfo
loadErrorInfo
=
new
LoadErrorInfo
(
loadEventInfo
,
mediaLoadData
,
error
,
errorCount
);
LoadErrorAction
loadErrorAction
;
long
blacklist
DurationMs
=
loadErrorHandlingPolicy
.
getBlacklistDurationMsFor
(
loadErrorInfo
);
boolean
should
Blacklist
=
blacklist
DurationMs
!=
C
.
TIME_UNSET
;
long
exclusion
DurationMs
=
loadErrorHandlingPolicy
.
getBlacklistDurationMsFor
(
loadErrorInfo
);
boolean
should
Exclude
=
exclusion
DurationMs
!=
C
.
TIME_UNSET
;
boolean
blacklisting
Failed
=
notifyPlaylistError
(
playlistUrl
,
blacklistDurationMs
)
||
!
shouldBlacklist
;
if
(
should
Blacklist
)
{
blacklistingFailed
|=
blacklistPlaylist
(
blacklist
DurationMs
);
boolean
exclusion
Failed
=
notifyPlaylistError
(
playlistUrl
,
exclusionDurationMs
)
||
!
shouldExclude
;
if
(
should
Exclude
)
{
exclusionFailed
|=
excludePlaylist
(
exclusion
DurationMs
);
}
if
(
blacklisting
Failed
)
{
if
(
exclusion
Failed
)
{
long
retryDelay
=
loadErrorHandlingPolicy
.
getRetryDelayMsFor
(
loadErrorInfo
);
loadErrorAction
=
retryDelay
!=
C
.
TIME_UNSET
...
...
@@ -654,7 +654,7 @@ public final class DefaultHlsPlaylistTracker
<
playlistSnapshot
.
mediaSequence
)
{
// TODO: Allow customization of playlist resets handling.
// The media sequence jumped backwards. The server has probably reset. We do not try
//
blacklist
ing in this case.
//
exclud
ing in this case.
playlistError
=
new
PlaylistResetException
(
playlistUrl
);
notifyPlaylistError
(
playlistUrl
,
C
.
TIME_UNSET
);
}
else
if
(
currentTimeMs
-
lastSnapshotChangeMs
...
...
@@ -668,11 +668,11 @@ public final class DefaultHlsPlaylistTracker
new
MediaLoadData
(
C
.
DATA_TYPE_MANIFEST
),
playlistError
,
/* errorCount= */
1
);
long
blacklist
DurationMs
=
long
exclusion
DurationMs
=
loadErrorHandlingPolicy
.
getBlacklistDurationMsFor
(
loadErrorInfo
);
notifyPlaylistError
(
playlistUrl
,
blacklist
DurationMs
);
if
(
blacklist
DurationMs
!=
C
.
TIME_UNSET
)
{
blacklistPlaylist
(
blacklist
DurationMs
);
notifyPlaylistError
(
playlistUrl
,
exclusion
DurationMs
);
if
(
exclusion
DurationMs
!=
C
.
TIME_UNSET
)
{
excludePlaylist
(
exclusion
DurationMs
);
}
}
}
...
...
@@ -693,14 +693,14 @@ public final class DefaultHlsPlaylistTracker
}
/**
*
Blacklist
s the playlist.
*
Exclude
s the playlist.
*
* @param
blacklist
DurationMs The number of milliseconds for which the playlist should be
*
blacklist
ed.
* @return Whether the playlist is the primary, despite being
blacklist
ed.
* @param
exclusion
DurationMs The number of milliseconds for which the playlist should be
*
exclud
ed.
* @return Whether the playlist is the primary, despite being
exclud
ed.
*/
private
boolean
blacklistPlaylist
(
long
blacklist
DurationMs
)
{
blacklistUntilMs
=
SystemClock
.
elapsedRealtime
()
+
blacklist
DurationMs
;
private
boolean
excludePlaylist
(
long
exclusion
DurationMs
)
{
excludeUntilMs
=
SystemClock
.
elapsedRealtime
()
+
exclusion
DurationMs
;
return
playlistUrl
.
equals
(
primaryMediaPlaylistUrl
)
&&
!
maybeSelectNewPrimaryUrl
();
}
}
...
...
library/hls/src/main/java/com/google/android/exoplayer2/source/hls/playlist/HlsPlaylistTracker.java
View file @
0ee3a35a
...
...
@@ -32,7 +32,7 @@ import java.io.IOException;
* media playlists while the master playlist is an optional kind of playlist defined by the HLS
* specification (RFC 8216).
*
* <p>Playlist loads might encounter errors. The tracker may choose to
blacklist
them to ensure a
* <p>Playlist loads might encounter errors. The tracker may choose to
exclude
them to ensure a
* primary playlist is always available.
*/
public
interface
HlsPlaylistTracker
{
...
...
@@ -76,11 +76,11 @@ public interface HlsPlaylistTracker {
* Called if an error is encountered while loading a playlist.
*
* @param url The loaded url that caused the error.
* @param
blacklistDurationMs The duration for which the playlist should be blacklisted. Or
*
{@link C#TIME_UNSET} if the playlist should not be blacklist
ed.
* @return True if
blacklist
ing did not encounter errors. False otherwise.
* @param
exclusionDurationMs The duration for which the playlist should be excluded. Or {@link
*
C#TIME_UNSET} if the playlist should not be exclud
ed.
* @return True if
exclud
ing did not encounter errors. False otherwise.
*/
boolean
onPlaylistError
(
Uri
url
,
long
blacklist
DurationMs
);
boolean
onPlaylistError
(
Uri
url
,
long
exclusion
DurationMs
);
}
/** Thrown when a playlist is considered to be stuck due to a server side error. */
...
...
@@ -208,10 +208,10 @@ public interface HlsPlaylistTracker {
void
maybeThrowPlaylistRefreshError
(
Uri
url
)
throws
IOException
;
/**
* Requests a playlist refresh and
whitelists i
t.
* Requests a playlist refresh and
removes it from the exclusion lis
t.
*
* <p>The playlist tracker may choose t
he delay the playlist refresh. The request is discarded if
*
a
refresh was already pending.
* <p>The playlist tracker may choose t
o delay the playlist refresh. The request is discarded if a
* refresh was already pending.
*
* @param url The {@link Uri} of the playlist to be refreshed.
*/
...
...
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