@Test public void testGetBufferedPositionUsReturnsEndOfSourceWhenAllLoaderBufferedTillEndOfSource() { FakeSequenceableLoader loader1 = new FakeSequenceableLoader( C.TIME_END_OF_SOURCE, C.TIME_END_OF_SOURCE); FakeSequenceableLoader loader2 = new FakeSequenceableLoader( C.TIME_END_OF_SOURCE, C.TIME_END_OF_SOURCE); CompositeSequenceableLoader compositeSequenceableLoader = new CompositeSequenceableLoader( new SequenceableLoader[] {loader1, loader2}); assertThat(compositeSequenceableLoader.getBufferedPositionUs()).isEqualTo(C.TIME_END_OF_SOURCE); }
@Override public final long getBufferedPositionUs() { long bufferedPositionUs = Long.MAX_VALUE; for (SequenceableLoader loader : loaders) { long loaderBufferedPositionUs = loader.getBufferedPositionUs(); if (loaderBufferedPositionUs != C.TIME_END_OF_SOURCE) { bufferedPositionUs = Math.min(bufferedPositionUs, loaderBufferedPositionUs); } } return bufferedPositionUs == Long.MAX_VALUE ? C.TIME_END_OF_SOURCE : bufferedPositionUs; }
CompositeSequenceableLoader implements SequenceableLoader { @Override public final long getBufferedPositionUs() { long bufferedPositionUs = Long.MAX_VALUE; for (SequenceableLoader loader : loaders) { long loaderBufferedPositionUs = loader.getBufferedPositionUs(); if (loaderBufferedPositionUs != C.TIME_END_OF_SOURCE) { bufferedPositionUs = Math.min(bufferedPositionUs, loaderBufferedPositionUs); } } return bufferedPositionUs == Long.MAX_VALUE ? C.TIME_END_OF_SOURCE : bufferedPositionUs; } }
CompositeSequenceableLoader implements SequenceableLoader { @Override public final long getBufferedPositionUs() { long bufferedPositionUs = Long.MAX_VALUE; for (SequenceableLoader loader : loaders) { long loaderBufferedPositionUs = loader.getBufferedPositionUs(); if (loaderBufferedPositionUs != C.TIME_END_OF_SOURCE) { bufferedPositionUs = Math.min(bufferedPositionUs, loaderBufferedPositionUs); } } return bufferedPositionUs == Long.MAX_VALUE ? C.TIME_END_OF_SOURCE : bufferedPositionUs; } CompositeSequenceableLoader(SequenceableLoader[] loaders); }
CompositeSequenceableLoader implements SequenceableLoader { @Override public final long getBufferedPositionUs() { long bufferedPositionUs = Long.MAX_VALUE; for (SequenceableLoader loader : loaders) { long loaderBufferedPositionUs = loader.getBufferedPositionUs(); if (loaderBufferedPositionUs != C.TIME_END_OF_SOURCE) { bufferedPositionUs = Math.min(bufferedPositionUs, loaderBufferedPositionUs); } } return bufferedPositionUs == Long.MAX_VALUE ? C.TIME_END_OF_SOURCE : bufferedPositionUs; } CompositeSequenceableLoader(SequenceableLoader[] loaders); @Override final long getBufferedPositionUs(); @Override final long getNextLoadPositionUs(); @Override final void reevaluateBuffer(long positionUs); @Override boolean continueLoading(long positionUs); }
CompositeSequenceableLoader implements SequenceableLoader { @Override public final long getBufferedPositionUs() { long bufferedPositionUs = Long.MAX_VALUE; for (SequenceableLoader loader : loaders) { long loaderBufferedPositionUs = loader.getBufferedPositionUs(); if (loaderBufferedPositionUs != C.TIME_END_OF_SOURCE) { bufferedPositionUs = Math.min(bufferedPositionUs, loaderBufferedPositionUs); } } return bufferedPositionUs == Long.MAX_VALUE ? C.TIME_END_OF_SOURCE : bufferedPositionUs; } CompositeSequenceableLoader(SequenceableLoader[] loaders); @Override final long getBufferedPositionUs(); @Override final long getNextLoadPositionUs(); @Override final void reevaluateBuffer(long positionUs); @Override boolean continueLoading(long positionUs);  }