Skip to content

Commit

Permalink
Add end of TS input fix to HLS mode
Browse files Browse the repository at this point in the history
  • Loading branch information
dsparano committed Jun 14, 2023
1 parent 3ed8d64 commit ac4a3fe
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ public void consume(ParsableByteArray data) {
public void packetFinished(boolean isEndOfInput) {
if (isEndOfInput) {
sampleReader.onDataEnd(totalBytesWritten, 0, hasOutputFormat);
sampleReader.reset();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -506,6 +506,7 @@ public void end(long position) {
// Output a final sample with the nal units currently held
nalUnitStartPosition = position;
outputSample(0);
readingSample = false;
}

private static final class SliceHeaderData {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,7 @@ public void end(long position) {
// 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. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -323,13 +323,11 @@ public void release() {
}

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;
Expand Down

0 comments on commit ac4a3fe

Please sign in to comment.