mirror of
https://github.com/samsonjs/media.git
synced 2026-04-27 15:07:40 +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
|
@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 {
|
||||||
* 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();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue