@Test public void testGetNextLoadPositionUsReturnMinimumLoaderNextLoadPositionUs() { FakeSequenceableLoader loader1 = new FakeSequenceableLoader( 1000, 2001); FakeSequenceableLoader loader2 = new FakeSequenceableLoader( 1001, 2000); CompositeSequenceableLoader compositeSequenceableLoader = new CompositeSequenceableLoader( new SequenceableLoader[] {loader1, loader2}); assertThat(compositeSequenceableLoader.getNextLoadPositionUs()).isEqualTo(2000); }
@Override public final long getNextLoadPositionUs() { long nextLoadPositionUs = Long.MAX_VALUE; for (SequenceableLoader loader : loaders) { long loaderNextLoadPositionUs = loader.getNextLoadPositionUs(); if (loaderNextLoadPositionUs != C.TIME_END_OF_SOURCE) { nextLoadPositionUs = Math.min(nextLoadPositionUs, loaderNextLoadPositionUs); } } return nextLoadPositionUs == Long.MAX_VALUE ? C.TIME_END_OF_SOURCE : nextLoadPositionUs; }
CompositeSequenceableLoader implements SequenceableLoader { @Override public final long getNextLoadPositionUs() { long nextLoadPositionUs = Long.MAX_VALUE; for (SequenceableLoader loader : loaders) { long loaderNextLoadPositionUs = loader.getNextLoadPositionUs(); if (loaderNextLoadPositionUs != C.TIME_END_OF_SOURCE) { nextLoadPositionUs = Math.min(nextLoadPositionUs, loaderNextLoadPositionUs); } } return nextLoadPositionUs == Long.MAX_VALUE ? C.TIME_END_OF_SOURCE : nextLoadPositionUs; } }
CompositeSequenceableLoader implements SequenceableLoader { @Override public final long getNextLoadPositionUs() { long nextLoadPositionUs = Long.MAX_VALUE; for (SequenceableLoader loader : loaders) { long loaderNextLoadPositionUs = loader.getNextLoadPositionUs(); if (loaderNextLoadPositionUs != C.TIME_END_OF_SOURCE) { nextLoadPositionUs = Math.min(nextLoadPositionUs, loaderNextLoadPositionUs); } } return nextLoadPositionUs == Long.MAX_VALUE ? C.TIME_END_OF_SOURCE : nextLoadPositionUs; } CompositeSequenceableLoader(SequenceableLoader[] loaders); }
CompositeSequenceableLoader implements SequenceableLoader { @Override public final long getNextLoadPositionUs() { long nextLoadPositionUs = Long.MAX_VALUE; for (SequenceableLoader loader : loaders) { long loaderNextLoadPositionUs = loader.getNextLoadPositionUs(); if (loaderNextLoadPositionUs != C.TIME_END_OF_SOURCE) { nextLoadPositionUs = Math.min(nextLoadPositionUs, loaderNextLoadPositionUs); } } return nextLoadPositionUs == Long.MAX_VALUE ? C.TIME_END_OF_SOURCE : nextLoadPositionUs; } 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 getNextLoadPositionUs() { long nextLoadPositionUs = Long.MAX_VALUE; for (SequenceableLoader loader : loaders) { long loaderNextLoadPositionUs = loader.getNextLoadPositionUs(); if (loaderNextLoadPositionUs != C.TIME_END_OF_SOURCE) { nextLoadPositionUs = Math.min(nextLoadPositionUs, loaderNextLoadPositionUs); } } return nextLoadPositionUs == Long.MAX_VALUE ? C.TIME_END_OF_SOURCE : nextLoadPositionUs; } CompositeSequenceableLoader(SequenceableLoader[] loaders); @Override final long getBufferedPositionUs(); @Override final long getNextLoadPositionUs(); @Override final void reevaluateBuffer(long positionUs); @Override boolean continueLoading(long positionUs);  }