mirror of
https://github.com/androidx/media.git
synced 2025-05-09 16:40:55 +08:00
Relax assertion.
We've seen a few streams where this assertion fails. If you just skip the packet, things appear to recover correctly in all cases I've seen, so replacing failure with a warning.
This commit is contained in:
parent
ea21eba87e
commit
0756c3d28c
@ -427,10 +427,17 @@ public final class TsExtractor {
|
||||
@Override
|
||||
public void read(BitArray tsBuffer, boolean payloadUnitStartIndicator) {
|
||||
if (payloadUnitStartIndicator && !pesBuffer.isEmpty()) {
|
||||
// We've encountered the start of the next packet, but haven't yet read the body. Read it.
|
||||
// Note that this should only happen if the packet length was unspecified.
|
||||
Assertions.checkState(packetLength == 0);
|
||||
if (packetLength == 0) {
|
||||
// The length of the previous packet was unspecified. We've now seen the start of the
|
||||
// next one, so consume the previous packet's body.
|
||||
readPacketBody();
|
||||
} else {
|
||||
// Either we didn't have enough data to read the length of the previous packet, or we
|
||||
// did read the length but didn't receive that amount of data. Neither case is expected.
|
||||
Log.w(TAG, "Unexpected packet fragment of length " + pesBuffer.bytesLeft());
|
||||
pesBuffer.reset();
|
||||
packetLength = -1;
|
||||
}
|
||||
}
|
||||
|
||||
pesBuffer.append(tsBuffer, tsBuffer.bytesLeft());
|
||||
@ -448,7 +455,7 @@ public final class TsExtractor {
|
||||
private void readPacketStart() {
|
||||
int startCodePrefix = pesBuffer.readBits(24);
|
||||
if (startCodePrefix != 0x000001) {
|
||||
Log.e(TAG, "Unexpected start code prefix: " + startCodePrefix);
|
||||
Log.w(TAG, "Unexpected start code prefix: " + startCodePrefix);
|
||||
pesBuffer.reset();
|
||||
packetLength = -1;
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user