Add end of TS input fix to HLS mode

This commit is contained in:
Daniele Sparano 2023-06-14 17:07:53 +01:00 committed by Ian Baker
parent 550bc5be20
commit b553d2c3f9
4 changed files with 8 additions and 7 deletions

View File

@ -220,6 +220,7 @@ public final class H263Reader implements ElementaryStreamReader {
public void packetFinished(boolean isEndOfInput) {
if (isEndOfInput) {
sampleReader.onDataEnd(totalBytesWritten, 0, hasOutputFormat);
sampleReader.reset();
}
}

View File

@ -506,6 +506,7 @@ public final class H264Reader implements ElementaryStreamReader {
// Output a final sample with the nal units currently held
nalUnitStartPosition = position;
outputSample(0);
readingSample = false;
}
private static final class SliceHeaderData {

View File

@ -382,6 +382,7 @@ public final class H265Reader implements ElementaryStreamReader {
// Output a final sample with the nal units currently held
nalUnitPosition = position;
outputSample(0);
readingSample = false;
}
/** Returns whether a NAL unit type is one that occurs before any VCL NAL units in a sample. */

View File

@ -323,13 +323,11 @@ public final class TsExtractor implements Extractor {
}
if (!fillBufferWithAtLeastOnePacket(input)) {
if (mode != MODE_HLS) {
// Send a dummy 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) {
payloadReader.consume(new ParsableByteArray(), FLAG_PAYLOAD_UNIT_START_INDICATOR);
}
// Send a dummy 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) {
payloadReader.consume(new ParsableByteArray(), FLAG_PAYLOAD_UNIT_START_INDICATOR);
}
}
return RESULT_END_OF_INPUT;