Add a release note, fix some nullness and comments

This commit is contained in:
Ian Baker 2023-06-20 12:00:41 +01:00
parent b553d2c3f9
commit 35e179f080
8 changed files with 17 additions and 9 deletions

View File

@ -34,6 +34,9 @@
* Parse EXIF rotation data for image inputs.
* Track Selection:
* Extractors:
* MPEG-TS: Ensure the last frame is rendered by passing the last access
unit of a stream to the sample queue
([#7909](https://github.com/google/ExoPlayer/issues/7909)).
* Audio:
* Audio Offload:
* Add `AudioSink.getFormatOffloadSupport(Format)` that retrieves level of

View File

@ -218,10 +218,11 @@ public final class H262Reader implements ElementaryStreamReader {
@Override
public void packetFinished(boolean isEndOfInput) {
checkStateNotNull(output); // Asserts that createTracks has been called.
if (isEndOfInput) {
@C.BufferFlags int flags = sampleIsKeyframe ? C.BUFFER_FLAG_KEY_FRAME : 0;
int size = (int) (totalBytesWritten - samplePosition);
output.sampleMetadata(sampleTimeUs, flags, size, 0, null);
output.sampleMetadata(sampleTimeUs, flags, size, /* offset= */ 0, /* cryptoData= */ null);
}
}

View File

@ -218,8 +218,10 @@ public final class H263Reader implements ElementaryStreamReader {
@Override
public void packetFinished(boolean isEndOfInput) {
// Assert that createTracks has been called.
checkStateNotNull(sampleReader);
if (isEndOfInput) {
sampleReader.onDataEnd(totalBytesWritten, 0, hasOutputFormat);
sampleReader.onDataEnd(totalBytesWritten, /* bytesWrittenPastPosition= */ 0, hasOutputFormat);
sampleReader.reset();
}
}

View File

@ -169,6 +169,7 @@ public final class H264Reader implements ElementaryStreamReader {
@Override
public void packetFinished(boolean isEndOfInput) {
assertTracksCreated();
if (isEndOfInput) {
sampleReader.end(totalBytesWritten);
}
@ -503,9 +504,9 @@ public final class H264Reader implements ElementaryStreamReader {
}
public void end(long position) {
// Output a final sample with the nal units currently held
// Output a final sample with the NAL units currently held
nalUnitStartPosition = position;
outputSample(0);
outputSample(/* offset= */ 0);
readingSample = false;
}

View File

@ -174,6 +174,7 @@ public final class H265Reader implements ElementaryStreamReader {
@Override
public void packetFinished(boolean isEndOfInput) {
assertTracksCreated();
if (isEndOfInput) {
sampleReader.end(totalBytesWritten);
}
@ -379,9 +380,9 @@ public final class H265Reader implements ElementaryStreamReader {
}
public void end(long position) {
// Output a final sample with the nal units currently held
// Output a final sample with the NAL units currently held
nalUnitPosition = position;
outputSample(0);
outputSample(/* offset= */ 0);
readingSample = false;
}

View File

@ -149,7 +149,7 @@ public final class PesReader implements TsPayloadReader {
payloadSize -= readLength;
if (payloadSize == 0) {
// There are bytes left in data, see above, so this is not the end of input
reader.packetFinished(false);
reader.packetFinished(/* isEndOfInput= */ false);
setState(STATE_READING_HEADER);
}
}

View File

@ -357,7 +357,7 @@ public final class PsExtractor implements Extractor {
pesPayloadReader.packetStarted(timeUs, TsPayloadReader.FLAG_DATA_ALIGNMENT_INDICATOR);
pesPayloadReader.consume(data);
// We always have complete PES packets with program stream.
pesPayloadReader.packetFinished(false);
pesPayloadReader.packetFinished(/* isEndOfInput= */ false);
}
private void parseHeader() {

View File

@ -323,7 +323,7 @@ public final class TsExtractor implements Extractor {
}
if (!fillBufferWithAtLeastOnePacket(input)) {
// Send a dummy pusi to allow for packetFinished to be triggered on the last unit
// Send a synthesised empty pusi to allow for packetFinished to be triggered on the last unit.
for (int i = 0; i < tsPayloadReaders.size(); i++) {
TsPayloadReader payloadReader = tsPayloadReaders.valueAt(i);
if (payloadReader instanceof PesReader) {