Clear buffer's timeUs when setting end-of-stream in SampleQueue

PiperOrigin-RevId: 541657834
This commit is contained in:
ibaker 2023-06-19 17:00:12 +01:00 committed by Ian Baker
parent 6d648f8bdb
commit 69769c77b3
2 changed files with 6 additions and 1 deletions

View File

@ -39,7 +39,11 @@ public abstract class Buffer {
return getFlag(C.BUFFER_FLAG_FIRST_SAMPLE);
}
/** Returns whether the {@link C#BUFFER_FLAG_END_OF_STREAM} flag is set. */
/**
* Returns whether the {@link C#BUFFER_FLAG_END_OF_STREAM} flag is set.
*
* <p>If this is set, all other attributes of the buffer should be ignored.
*/
public final boolean isEndOfStream() {
return getFlag(C.BUFFER_FLAG_END_OF_STREAM);
}

View File

@ -694,6 +694,7 @@ public class SampleQueue implements TrackOutput {
if (!hasNextSample()) {
if (loadingFinished || isLastSampleQueued) {
buffer.setFlags(C.BUFFER_FLAG_END_OF_STREAM);
buffer.timeUs = C.TIME_END_OF_SOURCE;
return C.RESULT_BUFFER_READ;
} else if (upstreamFormat != null && (formatRequired || upstreamFormat != downstreamFormat)) {
onFormatResult(Assertions.checkNotNull(upstreamFormat), formatHolder);