mirror of
https://github.com/samsonjs/media.git
synced 2026-04-27 15:07:40 +00:00
Remove dead code (failed==false in all cases)
This commit is contained in:
parent
3b34b0682c
commit
87daa912d7
4 changed files with 6 additions and 14 deletions
|
|
@ -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 {
|
||||||
|
|
||||||
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 {
|
||||||
|
|
||||||
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 {
|
||||||
* @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
|
||||||
|
|
||||||
// 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
|
||||||
|
|
||||||
// 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;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue