Fix H264 transformer test, fix H265 byterange case; re-enable file H262 case

This commit is contained in:
Daniele Sparano 2024-04-16 12:20:42 +01:00 committed by Rohit Singh
parent 3cafb08a32
commit 029b8bad86
4 changed files with 12 additions and 8 deletions

View File

@ -518,8 +518,8 @@ public final class H264Reader implements ElementaryStreamReader {
public void end(long position) {
// Output a final sample with the NAL units currently held
nalUnitStartPosition = position + 1;
outputSample(/* offset= */ -1);
nalUnitStartPosition = position;
outputSample(/* offset= */ 0);
readingSample = false;
}

View File

@ -393,9 +393,12 @@ public final class H265Reader implements ElementaryStreamReader {
}
public void end(long position) {
// Output a final sample with the NAL units currently held
nalUnitPosition = position + 1;
outputSample(/* offset= */ -1);
// Output a sample with the NAL units since the current nalUnitPosition
outputSample(/* offset= */ (int)(position - nalUnitPosition));
// Output a final sample with the remaining NAL units up to the passed position
samplePosition = nalUnitPosition;
nalUnitPosition = position;
outputSample(/* offset= */ 0);
readingSample = false;
}

View File

@ -165,14 +165,14 @@ public final class PesReader implements TsPayloadReader {
bytesRead = 0;
}
public boolean canConsumeDummyEndOfInput() {
public boolean canConsumeDummyEndOfInput(boolean isModeHls) {
// Pusi only payload to trigger end of sample data is only applicable if
// pes does not have a length field and body is being read, another exclusion
// is due to H262 streams possibly having, in HLS mode, a pes across more than one segment
// which would trigger committing an unfinished sample in the middle of the access unit
return state == STATE_READING_BODY
&& payloadSize == C.LENGTH_UNSET
&& !(reader instanceof H262Reader);
&& !(isModeHls && reader instanceof H262Reader);
}
/**

View File

@ -452,7 +452,8 @@ public final class TsExtractor implements Extractor {
TsPayloadReader payloadReader = tsPayloadReaders.valueAt(i);
if (payloadReader instanceof PesReader) {
PesReader pesReader = (PesReader) payloadReader;
if (pesReader.canConsumeDummyEndOfInput()) {
boolean isModeHls = (mode == MODE_HLS);
if (pesReader.canConsumeDummyEndOfInput(isModeHls)) {
pesReader.consume(new ParsableByteArray(), FLAG_PAYLOAD_UNIT_START_INDICATOR);
}
}