Revert "Keep the input data constant in consume method"
This reverts commit 3bacb1646c9ecd01e403465c7643888e83a9e79d.
This commit is contained in:
parent
69a716f633
commit
c7fbf3437f
@ -104,8 +104,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
|||||||
// | RR |P|V| PLEN |PEBIT|
|
// | RR |P|V| PLEN |PEBIT|
|
||||||
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||||
int currentPosition = data.getPosition();
|
int currentPosition = data.getPosition();
|
||||||
ParsableByteArray bitstreamData = new ParsableByteArray(data.getData().clone());
|
int header = data.readUnsignedShort();
|
||||||
int header = bitstreamData.readUnsignedShort();
|
|
||||||
boolean pBitIsSet = (header & 0x400) > 0;
|
boolean pBitIsSet = (header & 0x400) > 0;
|
||||||
|
|
||||||
// Check if optional V (Video Redundancy Coding), PLEN or PEBIT is present, RFC4629 Section 5.1.
|
// Check if optional V (Video Redundancy Coding), PLEN or PEBIT is present, RFC4629 Section 5.1.
|
||||||
@ -124,16 +123,16 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
|||||||
}
|
}
|
||||||
gotFirstPacketOfH263Frame = true;
|
gotFirstPacketOfH263Frame = true;
|
||||||
|
|
||||||
int payloadStartCode = bitstreamData.peekUnsignedByte() & 0xFC;
|
int payloadStartCode = data.peekUnsignedByte() & 0xFC;
|
||||||
// Packets that begin with a Picture Start Code(100000). Refer RFC4629 Section 6.1.
|
// Packets that begin with a Picture Start Code(100000). Refer RFC4629 Section 6.1.
|
||||||
if (payloadStartCode < PICTURE_START_CODE) {
|
if (payloadStartCode < PICTURE_START_CODE) {
|
||||||
Log.w(TAG, "Picture start Code (PSC) missing, dropping packet.");
|
Log.w(TAG, "Picture start Code (PSC) missing, dropping packet.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Setting first two bytes of the start code. Refer RFC4629 Section 6.1.1.
|
// Setting first two bytes of the start code. Refer RFC4629 Section 6.1.1.
|
||||||
bitstreamData.getData()[currentPosition] = 0;
|
data.getData()[currentPosition] = 0;
|
||||||
bitstreamData.getData()[currentPosition + 1] = 0;
|
data.getData()[currentPosition + 1] = 0;
|
||||||
bitstreamData.setPosition(currentPosition);
|
data.setPosition(currentPosition);
|
||||||
} else if (gotFirstPacketOfH263Frame) {
|
} else if (gotFirstPacketOfH263Frame) {
|
||||||
// Check that this packet is in the sequence of the previous packet.
|
// Check that this packet is in the sequence of the previous packet.
|
||||||
int expectedSequenceNumber = RtpPacket.getNextSequenceNumber(previousSequenceNumber);
|
int expectedSequenceNumber = RtpPacket.getNextSequenceNumber(previousSequenceNumber);
|
||||||
@ -155,7 +154,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (fragmentedSampleSizeBytes == 0) {
|
if (fragmentedSampleSizeBytes == 0) {
|
||||||
parseVopHeader(bitstreamData, isOutputFormatSet);
|
parseVopHeader(data, isOutputFormatSet);
|
||||||
if (!isOutputFormatSet && isKeyFrame) {
|
if (!isOutputFormatSet && isKeyFrame) {
|
||||||
if (width != payloadFormat.format.width || height != payloadFormat.format.height) {
|
if (width != payloadFormat.format.width || height != payloadFormat.format.height) {
|
||||||
trackOutput.format(
|
trackOutput.format(
|
||||||
@ -164,9 +163,9 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
|||||||
isOutputFormatSet = true;
|
isOutputFormatSet = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int fragmentSize = bitstreamData.bytesLeft();
|
int fragmentSize = data.bytesLeft();
|
||||||
// Write the video sample.
|
// Write the video sample.
|
||||||
trackOutput.sampleData(bitstreamData, fragmentSize);
|
trackOutput.sampleData(data, fragmentSize);
|
||||||
fragmentedSampleSizeBytes += fragmentSize;
|
fragmentedSampleSizeBytes += fragmentSize;
|
||||||
sampleTimeUsOfFragmentedSample =
|
sampleTimeUsOfFragmentedSample =
|
||||||
toSampleUs(startTimeOffsetUs, timestamp, firstReceivedTimestamp);
|
toSampleUs(startTimeOffsetUs, timestamp, firstReceivedTimestamp);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user