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
87daa912
authored
Jul 21, 2015
by
Oliver Woodman
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Remove dead code (failed==false in all cases)
parent
3b34b068
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
6 additions
and
14 deletions
library/src/main/java/com/google/android/exoplayer/DefaultLoadControl.java
library/src/main/java/com/google/android/exoplayer/LoadControl.java
library/src/main/java/com/google/android/exoplayer/chunk/ChunkSampleSource.java
library/src/main/java/com/google/android/exoplayer/hls/HlsSampleSource.java
library/src/main/java/com/google/android/exoplayer/DefaultLoadControl.java
View file @
87daa912
...
@@ -162,18 +162,16 @@ public class DefaultLoadControl implements LoadControl {
...
@@ -162,18 +162,16 @@ public class DefaultLoadControl implements LoadControl {
@Override
@Override
public
boolean
update
(
Object
loader
,
long
playbackPositionUs
,
long
nextLoadPositionUs
,
public
boolean
update
(
Object
loader
,
long
playbackPositionUs
,
long
nextLoadPositionUs
,
boolean
loading
,
boolean
failed
)
{
boolean
loading
)
{
// Update the loader state.
// Update the loader state.
int
loaderBufferState
=
getLoaderBufferState
(
playbackPositionUs
,
nextLoadPositionUs
);
int
loaderBufferState
=
getLoaderBufferState
(
playbackPositionUs
,
nextLoadPositionUs
);
LoaderState
loaderState
=
loaderStates
.
get
(
loader
);
LoaderState
loaderState
=
loaderStates
.
get
(
loader
);
boolean
loaderStateChanged
=
loaderState
.
bufferState
!=
loaderBufferState
boolean
loaderStateChanged
=
loaderState
.
bufferState
!=
loaderBufferState
||
loaderState
.
nextLoadPositionUs
!=
nextLoadPositionUs
||
loaderState
.
loading
!=
loading
||
loaderState
.
nextLoadPositionUs
!=
nextLoadPositionUs
||
loaderState
.
loading
!=
loading
;
||
loaderState
.
failed
!=
failed
;
if
(
loaderStateChanged
)
{
if
(
loaderStateChanged
)
{
loaderState
.
bufferState
=
loaderBufferState
;
loaderState
.
bufferState
=
loaderBufferState
;
loaderState
.
nextLoadPositionUs
=
nextLoadPositionUs
;
loaderState
.
nextLoadPositionUs
=
nextLoadPositionUs
;
loaderState
.
loading
=
loading
;
loaderState
.
loading
=
loading
;
loaderState
.
failed
=
failed
;
}
}
// Update the buffer state.
// Update the buffer state.
...
@@ -213,18 +211,16 @@ public class DefaultLoadControl implements LoadControl {
...
@@ -213,18 +211,16 @@ public class DefaultLoadControl implements LoadControl {
private
void
updateControlState
()
{
private
void
updateControlState
()
{
boolean
loading
=
false
;
boolean
loading
=
false
;
boolean
failed
=
false
;
boolean
haveNextLoadPosition
=
false
;
boolean
haveNextLoadPosition
=
false
;
int
highestState
=
bufferState
;
int
highestState
=
bufferState
;
for
(
int
i
=
0
;
i
<
loaders
.
size
();
i
++)
{
for
(
int
i
=
0
;
i
<
loaders
.
size
();
i
++)
{
LoaderState
loaderState
=
loaderStates
.
get
(
loaders
.
get
(
i
));
LoaderState
loaderState
=
loaderStates
.
get
(
loaders
.
get
(
i
));
loading
|=
loaderState
.
loading
;
loading
|=
loaderState
.
loading
;
failed
|=
loaderState
.
failed
;
haveNextLoadPosition
|=
loaderState
.
nextLoadPositionUs
!=
-
1
;
haveNextLoadPosition
|=
loaderState
.
nextLoadPositionUs
!=
-
1
;
highestState
=
Math
.
max
(
highestState
,
loaderState
.
bufferState
);
highestState
=
Math
.
max
(
highestState
,
loaderState
.
bufferState
);
}
}
fillingBuffers
=
!
loaders
.
isEmpty
()
&&
!
failed
&&
(
loading
||
haveNextLoadPosition
)
fillingBuffers
=
!
loaders
.
isEmpty
()
&&
(
loading
||
haveNextLoadPosition
)
&&
(
highestState
==
BELOW_LOW_WATERMARK
&&
(
highestState
==
BELOW_LOW_WATERMARK
||
(
highestState
==
BETWEEN_WATERMARKS
&&
fillingBuffers
));
||
(
highestState
==
BETWEEN_WATERMARKS
&&
fillingBuffers
));
if
(
fillingBuffers
&&
!
streamingPrioritySet
)
{
if
(
fillingBuffers
&&
!
streamingPrioritySet
)
{
...
@@ -268,14 +264,12 @@ public class DefaultLoadControl implements LoadControl {
...
@@ -268,14 +264,12 @@ public class DefaultLoadControl implements LoadControl {
public
int
bufferState
;
public
int
bufferState
;
public
boolean
loading
;
public
boolean
loading
;
public
boolean
failed
;
public
long
nextLoadPositionUs
;
public
long
nextLoadPositionUs
;
public
LoaderState
(
int
bufferSizeContribution
)
{
public
LoaderState
(
int
bufferSizeContribution
)
{
this
.
bufferSizeContribution
=
bufferSizeContribution
;
this
.
bufferSizeContribution
=
bufferSizeContribution
;
bufferState
=
ABOVE_HIGH_WATERMARK
;
bufferState
=
ABOVE_HIGH_WATERMARK
;
loading
=
false
;
loading
=
false
;
failed
=
false
;
nextLoadPositionUs
=
-
1
;
nextLoadPositionUs
=
-
1
;
}
}
...
...
library/src/main/java/com/google/android/exoplayer/LoadControl.java
View file @
87daa912
...
@@ -68,10 +68,8 @@ public interface LoadControl {
...
@@ -68,10 +68,8 @@ public interface LoadControl {
* @param nextLoadPositionUs The loader's next load position. -1 if finished, failed, or if the
* @param nextLoadPositionUs The loader's next load position. -1 if finished, failed, or if the
* next load position is not yet known.
* next load position is not yet known.
* @param loading Whether the loader is currently loading data.
* @param loading Whether the loader is currently loading data.
* @param failed Whether the loader has failed.
* @return True if the loader is allowed to start its next load. False otherwise.
* @return True if the loader is allowed to start its next load. False otherwise.
*/
*/
boolean
update
(
Object
loader
,
long
playbackPositionUs
,
long
nextLoadPositionUs
,
boolean
update
(
Object
loader
,
long
playbackPositionUs
,
long
nextLoadPositionUs
,
boolean
loading
);
boolean
loading
,
boolean
failed
);
}
}
library/src/main/java/com/google/android/exoplayer/chunk/ChunkSampleSource.java
View file @
87daa912
...
@@ -426,7 +426,7 @@ public class ChunkSampleSource implements SampleSource, SampleSourceReader, Load
...
@@ -426,7 +426,7 @@ public class ChunkSampleSource implements SampleSource, SampleSourceReader, Load
// Update the control with our current state, and determine whether we're the next loader.
// Update the control with our current state, and determine whether we're the next loader.
boolean
nextLoader
=
loadControl
.
update
(
this
,
downstreamPositionUs
,
nextLoadPositionUs
,
boolean
nextLoader
=
loadControl
.
update
(
this
,
downstreamPositionUs
,
nextLoadPositionUs
,
loadingOrBackedOff
,
false
);
loadingOrBackedOff
);
if
(
isBackedOff
)
{
if
(
isBackedOff
)
{
long
elapsedMillis
=
now
-
currentLoadableExceptionTimestamp
;
long
elapsedMillis
=
now
-
currentLoadableExceptionTimestamp
;
...
...
library/src/main/java/com/google/android/exoplayer/hls/HlsSampleSource.java
View file @
87daa912
...
@@ -494,7 +494,7 @@ public class HlsSampleSource implements SampleSource, SampleSourceReader, Loader
...
@@ -494,7 +494,7 @@ public class HlsSampleSource implements SampleSource, SampleSourceReader, Loader
// Update the control with our current state, and determine whether we're the next loader.
// Update the control with our current state, and determine whether we're the next loader.
boolean
nextLoader
=
loadControl
.
update
(
this
,
downstreamPositionUs
,
nextLoadPositionUs
,
boolean
nextLoader
=
loadControl
.
update
(
this
,
downstreamPositionUs
,
nextLoadPositionUs
,
loadingOrBackedOff
,
false
);
loadingOrBackedOff
);
if
(
isBackedOff
)
{
if
(
isBackedOff
)
{
long
elapsedMillis
=
now
-
currentLoadableExceptionTimestamp
;
long
elapsedMillis
=
now
-
currentLoadableExceptionTimestamp
;
...
...
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