MediaCodecRenderer: do not call protected methods from constructor
MediaCodecRenderer is calling its protected methods resetCodecStateForRelease() and resetCodecStateForFlush() from its constructor. Classess that override the methods (eg. DebugMediaCodecVideoRenderer) need to checks if the methods are called from the superclass constructor thus their members are not initialized yet. With this change, the MCR constructor does not call the two methods and sets the respective state directly on its fields. PiperOrigin-RevId: 370445978
This commit is contained in:
parent
3f3d1fb5f2
commit
a162d689b6
@ -416,7 +416,17 @@ public abstract class MediaCodecRenderer extends BaseRenderer {
|
||||
// endianness.
|
||||
bypassBatchBuffer.ensureSpaceForWrite(/* length= */ 0);
|
||||
bypassBatchBuffer.data.order(ByteOrder.nativeOrder());
|
||||
resetCodecStateForRelease();
|
||||
|
||||
codecOperatingRate = CODEC_OPERATING_RATE_UNSET;
|
||||
codecAdaptationWorkaroundMode = ADAPTATION_WORKAROUND_MODE_NEVER;
|
||||
codecReconfigurationState = RECONFIGURATION_STATE_NONE;
|
||||
inputIndex = C.INDEX_UNSET;
|
||||
outputIndex = C.INDEX_UNSET;
|
||||
codecHotswapDeadlineMs = C.TIME_UNSET;
|
||||
largestQueuedPresentationTimeUs = C.TIME_UNSET;
|
||||
lastBufferInStreamPresentationTimeUs = C.TIME_UNSET;
|
||||
codecDrainState = DRAIN_STATE_NONE;
|
||||
codecDrainAction = DRAIN_ACTION_NONE;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -140,10 +140,7 @@ import java.util.ArrayList;
|
||||
protected void resetCodecStateForFlush() {
|
||||
super.resetCodecStateForFlush();
|
||||
clearTimestamps();
|
||||
|
||||
if (inputFormatChangeTimesUs != null) {
|
||||
inputFormatChangeTimesUs.clear();
|
||||
}
|
||||
inputFormatChangeTimesUs.clear();
|
||||
inputFormatChanged = false;
|
||||
outputMediaFormatChanged = false;
|
||||
currentMediaFormat = null;
|
||||
|
Loading…
x
Reference in New Issue
Block a user