Only read from FormatHolder when a format has been read

I think we need to start clearing the holder as part of the
DRM rework. When we do this, it'll only be valid to read
from the holder immediately after it's been populated.

PiperOrigin-RevId: 262362725
This commit is contained in:
olly 2019-08-08 16:56:57 +01:00 committed by Oliver Woodman
parent 9f55045eeb
commit a14df33dc7
2 changed files with 5 additions and 2 deletions

View File

@ -847,7 +847,7 @@ public class LibvpxVideoRenderer extends BaseRenderer {
pendingFormat = null;
}
inputBuffer.flip();
inputBuffer.colorInfo = formatHolder.format.colorInfo;
inputBuffer.colorInfo = format.colorInfo;
onQueueInputBuffer(inputBuffer);
decoder.queueInputBuffer(inputBuffer);
buffersInCodecCount++;

View File

@ -52,6 +52,7 @@ public final class MetadataRenderer extends BaseRenderer implements Callback {
private int pendingMetadataCount;
private MetadataDecoder decoder;
private boolean inputStreamEnded;
private long subsampleOffsetUs;
/**
* @param output The output.
@ -120,7 +121,7 @@ public final class MetadataRenderer extends BaseRenderer implements Callback {
// If we ever need to support a metadata format where this is not the case, we'll need to
// pass the buffer to the decoder and discard the output.
} else {
buffer.subsampleOffsetUs = formatHolder.format.subsampleOffsetUs;
buffer.subsampleOffsetUs = subsampleOffsetUs;
buffer.flip();
int index = (pendingMetadataIndex + pendingMetadataCount) % MAX_PENDING_METADATA_COUNT;
Metadata metadata = decoder.decode(buffer);
@ -130,6 +131,8 @@ public final class MetadataRenderer extends BaseRenderer implements Callback {
pendingMetadataCount++;
}
}
} else if (result == C.RESULT_FORMAT_READ) {
subsampleOffsetUs = formatHolder.format.subsampleOffsetUs;
}
}