Merge "Fix some memory leakage"

This commit is contained in:
Treehugger Robot 2023-05-22 22:27:12 +00:00 committed by Gerrit Code Review
commit d52e734a2e

View File

@ -3089,7 +3089,10 @@ final public class MediaCodec {
mValid = false; mValid = false;
mNativeContext = 0; mNativeContext = 0;
} }
sPool.offer(this);
if (!mInternal) {
sPool.offer(this);
}
} }
private native void native_recycle(); private native void native_recycle();
@ -3153,6 +3156,7 @@ final public class MediaCodec {
mNativeContext = context; mNativeContext = context;
mMappable = isMappable; mMappable = isMappable;
mValid = (context != 0); mValid = (context != 0);
mInternal = true;
} }
private static final BlockingQueue<LinearBlock> sPool = private static final BlockingQueue<LinearBlock> sPool =
@ -3163,6 +3167,7 @@ final public class MediaCodec {
private boolean mMappable = false; private boolean mMappable = false;
private ByteBuffer mMapped = null; private ByteBuffer mMapped = null;
private long mNativeContext = 0; private long mNativeContext = 0;
private boolean mInternal = false;
} }
/** /**