mirror of
https://github.com/samsonjs/media.git
synced 2026-03-29 10:05:48 +00:00
Fix issue seeking backward when using SingleSampleSource.
Issue: #1193 ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=117136800
This commit is contained in:
parent
c98f7e8348
commit
61adcf98d2
1 changed files with 6 additions and 1 deletions
|
|
@ -58,6 +58,7 @@ public final class SingleSampleSource implements SampleSource, TrackStream, Load
|
|||
private byte[] sampleData;
|
||||
private int sampleSize;
|
||||
|
||||
private long pendingResetPositionUs;
|
||||
private boolean loadingFinished;
|
||||
private Loader loader;
|
||||
private IOException currentLoadableException;
|
||||
|
|
@ -112,6 +113,7 @@ public final class SingleSampleSource implements SampleSource, TrackStream, Load
|
|||
@Override
|
||||
public TrackStream enable(TrackSelection selection, long positionUs) {
|
||||
state = STATE_SEND_FORMAT;
|
||||
pendingResetPositionUs = NO_RESET;
|
||||
clearCurrentLoadableException();
|
||||
maybeStartLoading();
|
||||
return this;
|
||||
|
|
@ -129,7 +131,9 @@ public final class SingleSampleSource implements SampleSource, TrackStream, Load
|
|||
|
||||
@Override
|
||||
public long readReset() {
|
||||
return TrackStream.NO_RESET;
|
||||
long resetPositionUs = pendingResetPositionUs;
|
||||
pendingResetPositionUs = NO_RESET;
|
||||
return resetPositionUs;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -159,6 +163,7 @@ public final class SingleSampleSource implements SampleSource, TrackStream, Load
|
|||
@Override
|
||||
public void seekToUs(long positionUs) {
|
||||
if (state == STATE_END_OF_STREAM) {
|
||||
pendingResetPositionUs = positionUs;
|
||||
state = STATE_SEND_SAMPLE;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue