Commit 03823843 by olly Committed by Oliver Woodman

Re-enable codec re-use

Issue: #2826

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=219130576
parent 4824f352
......@@ -536,6 +536,16 @@ public abstract class MediaCodecRenderer extends BaseRenderer {
@Override
protected void onDisabled() {
inputFormat = null;
if (drmSession != null || pendingDrmSession != null) {
// TODO: Do something better with this case.
onReset();
} else {
flushOrReleaseCodec();
}
}
@Override
protected void onReset() {
try {
releaseCodec();
} finally {
......@@ -559,14 +569,14 @@ public abstract class MediaCodecRenderer extends BaseRenderer {
protected void releaseCodec() {
availableCodecInfos = null;
if (codec != null) {
codecInfo = null;
codecFormat = null;
resetInputBuffer();
resetOutputBuffer();
resetCodecBuffers();
codecHotswapDeadlineMs = C.TIME_UNSET;
waitingForKeys = false;
codecHotswapDeadlineMs = C.TIME_UNSET;
decodeOnlyPresentationTimestamps.clear();
codecInfo = null;
codecFormat = null;
decoderCounters.decoderReleaseCount++;
try {
codec.stop();
......
......@@ -283,8 +283,12 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer {
@Override
protected void onEnabled(boolean joining) throws ExoPlaybackException {
super.onEnabled(joining);
int oldTunnelingAudioSessionId = tunnelingAudioSessionId;
tunnelingAudioSessionId = getConfiguration().tunnelingAudioSessionId;
tunneling = tunnelingAudioSessionId != C.AUDIO_SESSION_ID_UNSET;
if (tunnelingAudioSessionId != oldTunnelingAudioSessionId) {
releaseCodec();
}
eventDispatcher.enabled(decoderCounters);
frameReleaseTimeHelper.enable();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment