Commit 52c53421 by Oliver Woodman

getBufferedPosition can't return unknown anymore

parent 4c434005
...@@ -139,18 +139,14 @@ public final class MultiSampleSource implements SampleSource { ...@@ -139,18 +139,14 @@ public final class MultiSampleSource implements SampleSource {
@Override @Override
public long getBufferedPositionUs() { public long getBufferedPositionUs() {
long bufferedPositionUs = durationUs != C.UNSET_TIME_US ? durationUs : Long.MAX_VALUE; long bufferedPositionUs = Long.MAX_VALUE;
for (SampleSource source : enabledSources) { for (SampleSource source : enabledSources) {
long rendererBufferedPositionUs = source.getBufferedPositionUs(); long rendererBufferedPositionUs = source.getBufferedPositionUs();
if (rendererBufferedPositionUs == C.UNSET_TIME_US) { if (rendererBufferedPositionUs != C.END_OF_SOURCE_US) {
return C.UNSET_TIME_US;
} else if (rendererBufferedPositionUs == C.END_OF_SOURCE_US) {
// This source is fully buffered.
} else {
bufferedPositionUs = Math.min(bufferedPositionUs, rendererBufferedPositionUs); bufferedPositionUs = Math.min(bufferedPositionUs, rendererBufferedPositionUs);
} }
} }
return bufferedPositionUs == Long.MAX_VALUE ? C.UNSET_TIME_US : bufferedPositionUs; return bufferedPositionUs == Long.MAX_VALUE ? C.END_OF_SOURCE_US : bufferedPositionUs;
} }
@Override @Override
......
...@@ -101,8 +101,7 @@ public interface SampleSource { ...@@ -101,8 +101,7 @@ public interface SampleSource {
* This method should only be called when at least one track is selected. * This method should only be called when at least one track is selected.
* *
* @return An estimate of the absolute position in microseconds up to which data is buffered, or * @return An estimate of the absolute position in microseconds up to which data is buffered, or
* {@link C#END_OF_SOURCE_US} if the track is fully buffered, or {@link C#UNSET_TIME_US} if no * {@link C#END_OF_SOURCE_US} if the track is fully buffered.
* estimate is available.
*/ */
long getBufferedPositionUs(); long getBufferedPositionUs();
......
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