Commit cb5c7891 by olly Committed by Oliver Woodman

Simplify notification of downstream format change for embedded track

- There's no particular need to read or skip a sample before notifying
- Add missing isPendingReset check

Issue: #4533

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=211959762
parent 38386c48
...@@ -753,6 +753,10 @@ public class ChunkSampleStream<T extends ChunkSource> implements SampleStream, S ...@@ -753,6 +753,10 @@ public class ChunkSampleStream<T extends ChunkSource> implements SampleStream, S
@Override @Override
public int skipData(long positionUs) { public int skipData(long positionUs) {
if (isPendingReset()) {
return 0;
}
maybeNotifyTrackFormatChanged();
int skipCount; int skipCount;
if (loadingFinished && positionUs > sampleQueue.getLargestQueuedTimestampUs()) { if (loadingFinished && positionUs > sampleQueue.getLargestQueuedTimestampUs()) {
skipCount = sampleQueue.advanceToEnd(); skipCount = sampleQueue.advanceToEnd();
...@@ -762,9 +766,6 @@ public class ChunkSampleStream<T extends ChunkSource> implements SampleStream, S ...@@ -762,9 +766,6 @@ public class ChunkSampleStream<T extends ChunkSource> implements SampleStream, S
skipCount = 0; skipCount = 0;
} }
} }
if (skipCount > 0) {
maybeNotifyTrackFormatChanged();
}
return skipCount; return skipCount;
} }
...@@ -779,13 +780,9 @@ public class ChunkSampleStream<T extends ChunkSource> implements SampleStream, S ...@@ -779,13 +780,9 @@ public class ChunkSampleStream<T extends ChunkSource> implements SampleStream, S
if (isPendingReset()) { if (isPendingReset()) {
return C.RESULT_NOTHING_READ; return C.RESULT_NOTHING_READ;
} }
int result = maybeNotifyTrackFormatChanged();
sampleQueue.read( return sampleQueue.read(
formatHolder, buffer, formatRequired, loadingFinished, decodeOnlyUntilPositionUs); formatHolder, buffer, formatRequired, loadingFinished, decodeOnlyUntilPositionUs);
if (result == C.RESULT_BUFFER_READ) {
maybeNotifyTrackFormatChanged();
}
return result;
} }
public void release() { public void release() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment