mirror of
https://github.com/samsonjs/media.git
synced 2026-04-19 13:35:47 +00:00
Decouple dummySurface lifespan from codec lifespans
I don't think there's any particular reason for releasing dummySurface when we release the codec. It seems to make more sense to decouple the two, and treat a dummySurface as a resource that should be released on reset. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=217711788
This commit is contained in:
parent
80e9c84a9e
commit
3805717026
1 changed files with 15 additions and 7 deletions
|
|
@ -381,6 +381,21 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onReset() {
|
||||
try {
|
||||
super.onReset();
|
||||
} finally {
|
||||
if (dummySurface != null) {
|
||||
if (surface == dummySurface) {
|
||||
surface = null;
|
||||
}
|
||||
dummySurface.release();
|
||||
dummySurface = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleMessage(int messageType, @Nullable Object message) throws ExoPlaybackException {
|
||||
if (messageType == C.MSG_SET_SURFACE) {
|
||||
|
|
@ -509,13 +524,6 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer {
|
|||
super.releaseCodec();
|
||||
} finally {
|
||||
buffersInCodecCount = 0;
|
||||
if (dummySurface != null) {
|
||||
if (surface == dummySurface) {
|
||||
surface = null;
|
||||
}
|
||||
dummySurface.release();
|
||||
dummySurface = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue