Commit 38057170 by olly Committed by Oliver Woodman

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
parent 80e9c84a
...@@ -382,6 +382,21 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer { ...@@ -382,6 +382,21 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer {
} }
@Override @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 { public void handleMessage(int messageType, @Nullable Object message) throws ExoPlaybackException {
if (messageType == C.MSG_SET_SURFACE) { if (messageType == C.MSG_SET_SURFACE) {
setSurface((Surface) message); setSurface((Surface) message);
...@@ -509,13 +524,6 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer { ...@@ -509,13 +524,6 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer {
super.releaseCodec(); super.releaseCodec();
} finally { } finally {
buffersInCodecCount = 0; buffersInCodecCount = 0;
if (dummySurface != null) {
if (surface == dummySurface) {
surface = null;
}
dummySurface.release();
dummySurface = null;
}
} }
} }
......
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