mirror of
https://github.com/androidx/media.git
synced 2025-04-30 06:46:50 +08:00
Re-enable codec re-use
Issue: #2826 ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=219130576
This commit is contained in:
parent
4824f352de
commit
038238430b
@ -536,6 +536,16 @@ public abstract class MediaCodecRenderer extends BaseRenderer {
|
|||||||
@Override
|
@Override
|
||||||
protected void onDisabled() {
|
protected void onDisabled() {
|
||||||
inputFormat = null;
|
inputFormat = null;
|
||||||
|
if (drmSession != null || pendingDrmSession != null) {
|
||||||
|
// TODO: Do something better with this case.
|
||||||
|
onReset();
|
||||||
|
} else {
|
||||||
|
flushOrReleaseCodec();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onReset() {
|
||||||
try {
|
try {
|
||||||
releaseCodec();
|
releaseCodec();
|
||||||
} finally {
|
} finally {
|
||||||
@ -559,14 +569,14 @@ public abstract class MediaCodecRenderer extends BaseRenderer {
|
|||||||
protected void releaseCodec() {
|
protected void releaseCodec() {
|
||||||
availableCodecInfos = null;
|
availableCodecInfos = null;
|
||||||
if (codec != null) {
|
if (codec != null) {
|
||||||
|
codecInfo = null;
|
||||||
|
codecFormat = null;
|
||||||
resetInputBuffer();
|
resetInputBuffer();
|
||||||
resetOutputBuffer();
|
resetOutputBuffer();
|
||||||
resetCodecBuffers();
|
resetCodecBuffers();
|
||||||
codecHotswapDeadlineMs = C.TIME_UNSET;
|
|
||||||
waitingForKeys = false;
|
waitingForKeys = false;
|
||||||
|
codecHotswapDeadlineMs = C.TIME_UNSET;
|
||||||
decodeOnlyPresentationTimestamps.clear();
|
decodeOnlyPresentationTimestamps.clear();
|
||||||
codecInfo = null;
|
|
||||||
codecFormat = null;
|
|
||||||
decoderCounters.decoderReleaseCount++;
|
decoderCounters.decoderReleaseCount++;
|
||||||
try {
|
try {
|
||||||
codec.stop();
|
codec.stop();
|
||||||
|
@ -283,8 +283,12 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer {
|
|||||||
@Override
|
@Override
|
||||||
protected void onEnabled(boolean joining) throws ExoPlaybackException {
|
protected void onEnabled(boolean joining) throws ExoPlaybackException {
|
||||||
super.onEnabled(joining);
|
super.onEnabled(joining);
|
||||||
|
int oldTunnelingAudioSessionId = tunnelingAudioSessionId;
|
||||||
tunnelingAudioSessionId = getConfiguration().tunnelingAudioSessionId;
|
tunnelingAudioSessionId = getConfiguration().tunnelingAudioSessionId;
|
||||||
tunneling = tunnelingAudioSessionId != C.AUDIO_SESSION_ID_UNSET;
|
tunneling = tunnelingAudioSessionId != C.AUDIO_SESSION_ID_UNSET;
|
||||||
|
if (tunnelingAudioSessionId != oldTunnelingAudioSessionId) {
|
||||||
|
releaseCodec();
|
||||||
|
}
|
||||||
eventDispatcher.enabled(decoderCounters);
|
eventDispatcher.enabled(decoderCounters);
|
||||||
frameReleaseTimeHelper.enable();
|
frameReleaseTimeHelper.enable();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user