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
@ -58,6 +58,7 @@ public final class SingleSampleSource implements SampleSource, TrackStream, Load
|
|||||||
private byte[] sampleData;
|
private byte[] sampleData;
|
||||||
private int sampleSize;
|
private int sampleSize;
|
||||||
|
|
||||||
|
private long pendingResetPositionUs;
|
||||||
private boolean loadingFinished;
|
private boolean loadingFinished;
|
||||||
private Loader loader;
|
private Loader loader;
|
||||||
private IOException currentLoadableException;
|
private IOException currentLoadableException;
|
||||||
@ -112,6 +113,7 @@ public final class SingleSampleSource implements SampleSource, TrackStream, Load
|
|||||||
@Override
|
@Override
|
||||||
public TrackStream enable(TrackSelection selection, long positionUs) {
|
public TrackStream enable(TrackSelection selection, long positionUs) {
|
||||||
state = STATE_SEND_FORMAT;
|
state = STATE_SEND_FORMAT;
|
||||||
|
pendingResetPositionUs = NO_RESET;
|
||||||
clearCurrentLoadableException();
|
clearCurrentLoadableException();
|
||||||
maybeStartLoading();
|
maybeStartLoading();
|
||||||
return this;
|
return this;
|
||||||
@ -129,7 +131,9 @@ public final class SingleSampleSource implements SampleSource, TrackStream, Load
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long readReset() {
|
public long readReset() {
|
||||||
return TrackStream.NO_RESET;
|
long resetPositionUs = pendingResetPositionUs;
|
||||||
|
pendingResetPositionUs = NO_RESET;
|
||||||
|
return resetPositionUs;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -159,6 +163,7 @@ public final class SingleSampleSource implements SampleSource, TrackStream, Load
|
|||||||
@Override
|
@Override
|
||||||
public void seekToUs(long positionUs) {
|
public void seekToUs(long positionUs) {
|
||||||
if (state == STATE_END_OF_STREAM) {
|
if (state == STATE_END_OF_STREAM) {
|
||||||
|
pendingResetPositionUs = positionUs;
|
||||||
state = STATE_SEND_SAMPLE;
|
state = STATE_SEND_SAMPLE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user