Avoid create short lived object

PiperOrigin-RevId: 555204528
This commit is contained in:
claincly 2023-08-09 17:29:51 +00:00 committed by Tianyi Feng
parent 3351f0387f
commit 7e12d7619a

View file

@ -61,6 +61,7 @@ import org.checkerframework.dataflow.qual.Pure;
private static final String TAG = "VideoSampleExporter"; private static final String TAG = "VideoSampleExporter";
private final SingleInputVideoGraph singleInputVideoGraph; private final SingleInputVideoGraph singleInputVideoGraph;
private final EncoderWrapper encoderWrapper; private final EncoderWrapper encoderWrapper;
private final DecoderInputBuffer encoderOutputBuffer;
/** /**
* The timestamp of the last buffer processed before {@linkplain * The timestamp of the last buffer processed before {@linkplain
@ -104,6 +105,9 @@ import org.checkerframework.dataflow.qual.Pure;
transformationRequest, transformationRequest,
fallbackListener); fallbackListener);
encoderOutputBuffer =
new DecoderInputBuffer(DecoderInputBuffer.BUFFER_REPLACEMENT_MODE_DISABLED);
boolean isMediaCodecToneMapping = boolean isMediaCodecToneMapping =
encoderWrapper.getHdrModeAfterFallback() == HDR_MODE_TONE_MAP_HDR_TO_SDR_USING_MEDIACODEC encoderWrapper.getHdrModeAfterFallback() == HDR_MODE_TONE_MAP_HDR_TO_SDR_USING_MEDIACODEC
&& ColorInfo.isTransferHdr(decoderInputColor); && ColorInfo.isTransferHdr(decoderInputColor);
@ -193,8 +197,6 @@ import org.checkerframework.dataflow.qual.Pure;
@Override @Override
@Nullable @Nullable
protected DecoderInputBuffer getMuxerInputBuffer() throws ExportException { protected DecoderInputBuffer getMuxerInputBuffer() throws ExportException {
DecoderInputBuffer encoderOutputBuffer =
new DecoderInputBuffer(DecoderInputBuffer.BUFFER_REPLACEMENT_MODE_DISABLED);
encoderOutputBuffer.data = encoderWrapper.getOutputBuffer(); encoderOutputBuffer.data = encoderWrapper.getOutputBuffer();
if (encoderOutputBuffer.data == null) { if (encoderOutputBuffer.data == null) {
return null; return null;