[surfacetexture] Add patch to release current EglImage
[Description]
Add test patch to release current texture image when freeing the
corresponding buffer, in order to prevent EglImage reference leak
which would result in destructor not called.
Bug: 214353180
[Test Report]
Test Platform: palmer
1. AC ON/OFF: PASS
2. Launcher UI: PASS
3. CTS: PASS
4. CTS Command:
run cts -m CtsMediaTestCases -t android.media.cts.DecodeEditEncodeTest
run cts -m CtsMediaTestCases -t android.media.cts.EncodeDecodeTest
Change-Id: I4a02d62fe72e2b3013e7c352b77977a3b6b515ae
diff --git a/libs/nativedisplay/surfacetexture/EGLConsumer.cpp b/libs/nativedisplay/surfacetexture/EGLConsumer.cpp
index 2f31888..7bdfc0c 100644
--- a/libs/nativedisplay/surfacetexture/EGLConsumer.cpp
+++ b/libs/nativedisplay/surfacetexture/EGLConsumer.cpp
@@ -593,6 +593,10 @@
}
void EGLConsumer::onFreeBufferLocked(int slotIndex) {
+ if (mEglSlots[slotIndex].mEglImage != nullptr &&
+ mEglSlots[slotIndex].mEglImage == mCurrentTextureImage) {
+ mCurrentTextureImage.clear();
+ }
mEglSlots[slotIndex].mEglImage.clear();
}