mirror of
https://github.com/samsonjs/media.git
synced 2026-04-02 10:45:51 +00:00
Signal EoS when seeking ExtractorSampleSource to the end of a track.
This commit is contained in:
parent
2ce33c257a
commit
dd5eabdf4a
1 changed files with 10 additions and 0 deletions
|
|
@ -72,6 +72,7 @@ public class ExtractorSampleSource implements SampleSource, ExtractorOutput, Loa
|
|||
private boolean prepared;
|
||||
private int enabledTrackCount;
|
||||
private TrackInfo[] trackInfos;
|
||||
private long maxTrackDurationUs;
|
||||
private boolean[] pendingMediaFormat;
|
||||
private boolean[] pendingDiscontinuities;
|
||||
private boolean[] trackEnabledStates;
|
||||
|
|
@ -156,9 +157,13 @@ public class ExtractorSampleSource implements SampleSource, ExtractorOutput, Loa
|
|||
pendingDiscontinuities = new boolean[trackCount];
|
||||
pendingMediaFormat = new boolean[trackCount];
|
||||
trackInfos = new TrackInfo[trackCount];
|
||||
maxTrackDurationUs = C.UNKNOWN_TIME_US;
|
||||
for (int i = 0; i < trackCount; i++) {
|
||||
MediaFormat format = sampleQueues.valueAt(i).getFormat();
|
||||
trackInfos[i] = new TrackInfo(format.mimeType, format.durationUs);
|
||||
if (format.durationUs != C.UNKNOWN_TIME_US && format.durationUs > maxTrackDurationUs) {
|
||||
maxTrackDurationUs = format.durationUs;
|
||||
}
|
||||
}
|
||||
prepared = true;
|
||||
return true;
|
||||
|
|
@ -448,6 +453,11 @@ public class ExtractorSampleSource implements SampleSource, ExtractorOutput, Loa
|
|||
loadable = createLoadableFromStart();
|
||||
} else {
|
||||
Assertions.checkState(isPendingReset());
|
||||
if (maxTrackDurationUs != C.UNKNOWN_TIME_US && pendingResetPositionUs >= maxTrackDurationUs) {
|
||||
loadingFinished = true;
|
||||
pendingResetPositionUs = NO_RESET_PENDING;
|
||||
return;
|
||||
}
|
||||
loadable = createLoadableFromPositionUs(pendingResetPositionUs);
|
||||
pendingResetPositionUs = NO_RESET_PENDING;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue