Remove MediaCodec.stop() call before MediaCodec.release()

This was verified as a no-op change in a prod experiment.

PiperOrigin-RevId: 285167972
This commit is contained in:
olly 2019-12-12 12:46:11 +00:00 committed by Ian Baker
parent e8fa9a55a5
commit 0e1e4ad737

View File

@ -392,7 +392,6 @@ public abstract class MediaCodecRenderer extends BaseRenderer {
private boolean waitingForKeys;
private boolean waitingForFirstSyncSample;
private boolean waitingForFirstSampleInFormat;
private boolean skipMediaCodecStopOnRelease;
private boolean pendingOutputEndOfStream;
private @MediaCodecOperationMode int mediaCodecOperationMode;
@ -458,22 +457,6 @@ public abstract class MediaCodecRenderer extends BaseRenderer {
this.renderTimeLimitMs = renderTimeLimitMs;
}
/**
* Skip calling {@link MediaCodec#stop()} when the underlying MediaCodec is going to be released.
*
* <p>By default, when the MediaCodecRenderer is releasing the underlying {@link MediaCodec}, it
* first calls {@link MediaCodec#stop()} and then calls {@link MediaCodec#release()}. If this
* feature is enabled, the MediaCodecRenderer will skip the call to {@link MediaCodec#stop()}.
*
* <p>This method is experimental, and will be renamed or removed in a future release. It should
* only be called before the renderer is used.
*
* @param enabled enable or disable the feature.
*/
public void experimental_setSkipMediaCodecStopOnRelease(boolean enabled) {
skipMediaCodecStopOnRelease = enabled;
}
/**
* Set the mode of operation of the underlying {@link MediaCodec}.
*
@ -705,13 +688,7 @@ public abstract class MediaCodecRenderer extends BaseRenderer {
try {
if (codec != null) {
decoderCounters.decoderReleaseCount++;
try {
if (!skipMediaCodecStopOnRelease) {
codec.stop();
}
} finally {
codec.release();
}
codec.release();
}
} finally {
codec = null;