Tidy up dummy pusi, do not apply to H262 streams
This commit is contained in:
parent
85826ebc19
commit
b82f4b8e28
@ -36,10 +36,10 @@ public final class PesReader implements TsPayloadReader {
|
|||||||
|
|
||||||
private static final String TAG = "PesReader";
|
private static final String TAG = "PesReader";
|
||||||
|
|
||||||
public static final int STATE_FINDING_HEADER = 0;
|
private static final int STATE_FINDING_HEADER = 0;
|
||||||
public static final int STATE_READING_HEADER = 1;
|
private static final int STATE_READING_HEADER = 1;
|
||||||
public static final int STATE_READING_HEADER_EXTENSION = 2;
|
private static final int STATE_READING_HEADER_EXTENSION = 2;
|
||||||
public static final int STATE_READING_BODY = 3;
|
private static final int STATE_READING_BODY = 3;
|
||||||
|
|
||||||
private static final int HEADER_SIZE = 9;
|
private static final int HEADER_SIZE = 9;
|
||||||
private static final int MAX_HEADER_EXTENSION_SIZE = 10;
|
private static final int MAX_HEADER_EXTENSION_SIZE = 10;
|
||||||
@ -165,12 +165,14 @@ public final class PesReader implements TsPayloadReader {
|
|||||||
bytesRead = 0;
|
bytesRead = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getState() {
|
public boolean canConsumeDummyEndOfInput() {
|
||||||
return state;
|
// 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
|
||||||
public boolean hasPacketLength() {
|
// which would trigger committing an unfinished sample in the middle of the access unit
|
||||||
return payloadSize != C.LENGTH_UNSET;
|
return state == STATE_READING_BODY
|
||||||
|
&& payloadSize != C.LENGTH_UNSET
|
||||||
|
&& !(reader instanceof H262Reader);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -15,7 +15,6 @@
|
|||||||
*/
|
*/
|
||||||
package androidx.media3.extractor.ts;
|
package androidx.media3.extractor.ts;
|
||||||
|
|
||||||
import static androidx.media3.extractor.ts.PesReader.STATE_READING_BODY;
|
|
||||||
import static androidx.media3.extractor.ts.TsPayloadReader.EsInfo.AUDIO_TYPE_UNDEFINED;
|
import static androidx.media3.extractor.ts.TsPayloadReader.EsInfo.AUDIO_TYPE_UNDEFINED;
|
||||||
import static androidx.media3.extractor.ts.TsPayloadReader.FLAG_PAYLOAD_UNIT_START_INDICATOR;
|
import static androidx.media3.extractor.ts.TsPayloadReader.FLAG_PAYLOAD_UNIT_START_INDICATOR;
|
||||||
import static java.lang.annotation.ElementType.TYPE_USE;
|
import static java.lang.annotation.ElementType.TYPE_USE;
|
||||||
@ -453,7 +452,7 @@ public final class TsExtractor implements Extractor {
|
|||||||
TsPayloadReader payloadReader = tsPayloadReaders.valueAt(i);
|
TsPayloadReader payloadReader = tsPayloadReaders.valueAt(i);
|
||||||
if (payloadReader instanceof PesReader) {
|
if (payloadReader instanceof PesReader) {
|
||||||
PesReader pesReader = (PesReader)payloadReader;
|
PesReader pesReader = (PesReader)payloadReader;
|
||||||
if (pesReader.getState() == STATE_READING_BODY && !pesReader.hasPacketLength()) {
|
if (pesReader.canConsumeDummyEndOfInput()) {
|
||||||
pesReader.consume(new ParsableByteArray(), FLAG_PAYLOAD_UNIT_START_INDICATOR);
|
pesReader.consume(new ParsableByteArray(), FLAG_PAYLOAD_UNIT_START_INDICATOR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user