Remove dead code (failed==false in all cases)

This commit is contained in:
Oliver Woodman 2015-07-21 17:36:07 +01:00
parent 3b34b0682c
commit 87daa912d7
4 changed files with 6 additions and 14 deletions

View file

@ -162,18 +162,16 @@ public class DefaultLoadControl implements LoadControl {
@Override
public boolean update(Object loader, long playbackPositionUs, long nextLoadPositionUs,
boolean loading, boolean failed) {
boolean loading) {
// Update the loader state.
int loaderBufferState = getLoaderBufferState(playbackPositionUs, nextLoadPositionUs);
LoaderState loaderState = loaderStates.get(loader);
boolean loaderStateChanged = loaderState.bufferState != loaderBufferState
|| loaderState.nextLoadPositionUs != nextLoadPositionUs || loaderState.loading != loading
|| loaderState.failed != failed;
|| loaderState.nextLoadPositionUs != nextLoadPositionUs || loaderState.loading != loading;
if (loaderStateChanged) {
loaderState.bufferState = loaderBufferState;
loaderState.nextLoadPositionUs = nextLoadPositionUs;
loaderState.loading = loading;
loaderState.failed = failed;
}
// Update the buffer state.
@ -213,18 +211,16 @@ public class DefaultLoadControl implements LoadControl {
private void updateControlState() {
boolean loading = false;
boolean failed = false;
boolean haveNextLoadPosition = false;
int highestState = bufferState;
for (int i = 0; i < loaders.size(); i++) {
LoaderState loaderState = loaderStates.get(loaders.get(i));
loading |= loaderState.loading;
failed |= loaderState.failed;
haveNextLoadPosition |= loaderState.nextLoadPositionUs != -1;
highestState = Math.max(highestState, loaderState.bufferState);
}
fillingBuffers = !loaders.isEmpty() && !failed && (loading || haveNextLoadPosition)
fillingBuffers = !loaders.isEmpty() && (loading || haveNextLoadPosition)
&& (highestState == BELOW_LOW_WATERMARK
|| (highestState == BETWEEN_WATERMARKS && fillingBuffers));
if (fillingBuffers && !streamingPrioritySet) {
@ -268,14 +264,12 @@ public class DefaultLoadControl implements LoadControl {
public int bufferState;
public boolean loading;
public boolean failed;
public long nextLoadPositionUs;
public LoaderState(int bufferSizeContribution) {
this.bufferSizeContribution = bufferSizeContribution;
bufferState = ABOVE_HIGH_WATERMARK;
loading = false;
failed = false;
nextLoadPositionUs = -1;
}

View file

@ -68,10 +68,8 @@ public interface LoadControl {
* @param nextLoadPositionUs The loader's next load position. -1 if finished, failed, or if the
* next load position is not yet known.
* @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.
*/
boolean update(Object loader, long playbackPositionUs, long nextLoadPositionUs,
boolean loading, boolean failed);
boolean update(Object loader, long playbackPositionUs, long nextLoadPositionUs, boolean loading);
}

View file

@ -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.
boolean nextLoader = loadControl.update(this, downstreamPositionUs, nextLoadPositionUs,
loadingOrBackedOff, false);
loadingOrBackedOff);
if (isBackedOff) {
long elapsedMillis = now - currentLoadableExceptionTimestamp;

View file

@ -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.
boolean nextLoader = loadControl.update(this, downstreamPositionUs, nextLoadPositionUs,
loadingOrBackedOff, false);
loadingOrBackedOff);
if (isBackedOff) {
long elapsedMillis = now - currentLoadableExceptionTimestamp;