mirror of
https://github.com/samsonjs/media.git
synced 2026-03-27 09:45:47 +00:00
getBufferedPosition can't return unknown anymore
This commit is contained in:
parent
4c434005d4
commit
52c5342158
2 changed files with 4 additions and 9 deletions
|
|
@ -139,18 +139,14 @@ public final class MultiSampleSource implements SampleSource {
|
|||
|
||||
@Override
|
||||
public long getBufferedPositionUs() {
|
||||
long bufferedPositionUs = durationUs != C.UNSET_TIME_US ? durationUs : Long.MAX_VALUE;
|
||||
long bufferedPositionUs = Long.MAX_VALUE;
|
||||
for (SampleSource source : enabledSources) {
|
||||
long rendererBufferedPositionUs = source.getBufferedPositionUs();
|
||||
if (rendererBufferedPositionUs == C.UNSET_TIME_US) {
|
||||
return C.UNSET_TIME_US;
|
||||
} else if (rendererBufferedPositionUs == C.END_OF_SOURCE_US) {
|
||||
// This source is fully buffered.
|
||||
} else {
|
||||
if (rendererBufferedPositionUs != C.END_OF_SOURCE_US) {
|
||||
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
|
||||
|
|
|
|||
|
|
@ -101,8 +101,7 @@ public interface SampleSource {
|
|||
* 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
|
||||
* {@link C#END_OF_SOURCE_US} if the track is fully buffered, or {@link C#UNSET_TIME_US} if no
|
||||
* estimate is available.
|
||||
* {@link C#END_OF_SOURCE_US} if the track is fully buffered.
|
||||
*/
|
||||
long getBufferedPositionUs();
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue