mirror of
https://github.com/androidx/media.git
synced 2025-05-10 00:59:51 +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
|
@Override
|
||||||
public void read(BitArray tsBuffer, boolean payloadUnitStartIndicator) {
|
public void read(BitArray tsBuffer, boolean payloadUnitStartIndicator) {
|
||||||
if (payloadUnitStartIndicator && !pesBuffer.isEmpty()) {
|
if (payloadUnitStartIndicator && !pesBuffer.isEmpty()) {
|
||||||
// We've encountered the start of the next packet, but haven't yet read the body. Read it.
|
if (packetLength == 0) {
|
||||||
// Note that this should only happen if the packet length was unspecified.
|
// The length of the previous packet was unspecified. We've now seen the start of the
|
||||||
Assertions.checkState(packetLength == 0);
|
// next one, so consume the previous packet's body.
|
||||||
readPacketBody();
|
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());
|
pesBuffer.append(tsBuffer, tsBuffer.bytesLeft());
|
||||||
@ -448,7 +455,7 @@ public final class TsExtractor {
|
|||||||
private void readPacketStart() {
|
private void readPacketStart() {
|
||||||
int startCodePrefix = pesBuffer.readBits(24);
|
int startCodePrefix = pesBuffer.readBits(24);
|
||||||
if (startCodePrefix != 0x000001) {
|
if (startCodePrefix != 0x000001) {
|
||||||
Log.e(TAG, "Unexpected start code prefix: " + startCodePrefix);
|
Log.w(TAG, "Unexpected start code prefix: " + startCodePrefix);
|
||||||
pesBuffer.reset();
|
pesBuffer.reset();
|
||||||
packetLength = -1;
|
packetLength = -1;
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user