Fix VP8 Reader

Update VP8 header to check if the S bit is set.

Variable fragmentedSampleSizeBytes is initialised with -1, and reader
is directly adding fragmentSize to this variable.
Updated it to check if the size is unset.

Bug: 238153477
Test: manual
Change-Id: I9d5735422a4a0eeb2967af93809b879b434e3c57
This commit is contained in:
Shraddha Basantwani 2022-07-06 12:46:52 +05:30
parent 7d2eb76019
commit ff3d7dff12

View File

@ -113,7 +113,11 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
int fragmentSize = data.bytesLeft(); int fragmentSize = data.bytesLeft();
trackOutput.sampleData(data, fragmentSize); trackOutput.sampleData(data, fragmentSize);
fragmentedSampleSizeBytes += fragmentSize; if (fragmentedSampleSizeBytes == C.LENGTH_UNSET) {
fragmentedSampleSizeBytes = fragmentSize;
} else {
fragmentedSampleSizeBytes += fragmentSize;
}
if (rtpMarker) { if (rtpMarker) {
if (firstReceivedTimestamp == C.TIME_UNSET) { if (firstReceivedTimestamp == C.TIME_UNSET) {
@ -150,7 +154,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
if (!gotFirstPacketOfVp8Frame) { if (!gotFirstPacketOfVp8Frame) {
// TODO(b/198620566) Consider using ParsableBitArray. // TODO(b/198620566) Consider using ParsableBitArray.
// For start of VP8 partition S=1 and PID=0 as per RFC7741 Section 4.2. // For start of VP8 partition S=1 and PID=0 as per RFC7741 Section 4.2.
if ((header & 0x10) != 0x1 || (header & 0x07) != 0) { if ((header & 0x10) != 0x10 || (header & 0x07) != 0) {
Log.w(TAG, "RTP packet is not the start of a new VP8 partition, skipping."); Log.w(TAG, "RTP packet is not the start of a new VP8 partition, skipping.");
return false; return false;
} }