Automated g4 rollback of changelist 219585084.

*** Reason for rollback ***

Rolling forward again as [] should fix issue that prompted the rollback

*** Original change description ***

Automated g4 rollback of changelist 219130576.

*** Original change description ***

Re-enable codec re-use

Issue: #2826

***

***

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=220124362
This commit is contained in:
olly 2018-11-05 10:11:27 -08:00 committed by Oliver Woodman
parent 0afd9c17e6
commit 8844694dfd
2 changed files with 17 additions and 3 deletions

View File

@ -552,6 +552,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 {
@ -575,14 +585,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();

View File

@ -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();
}