Commit 87daa912 by Oliver Woodman

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

parent 3b34b068
...@@ -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;
} }
......
...@@ -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);
} }
...@@ -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;
......
...@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment