Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8bd6b74b authored by Pete Ricci's avatar Pete Ricci Committed by Gerrit Code Review
Browse files

Merge "Fix memory leak due to un-released gralloc buffers" into main

parents 601b8c31 5a2a4e51
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -7575,6 +7575,22 @@ bool ACodec::LoadedToIdleState::onOMXEvent(
            return true;
        }

        // When Acodec receive an error event at LoadedToIdleState, it will not release
        // allocated buffers, which will cause gralloc buffer leak issue. We need to first release
        // these buffers and then process the error event
        case OMX_EventError:
        {
            if (mCodec->allYourBuffersAreBelongToUs(kPortIndexInput)) {
                mCodec->freeBuffersOnPort(kPortIndexInput);
            }

            if (mCodec->allYourBuffersAreBelongToUs(kPortIndexOutput)) {
                mCodec->freeBuffersOnPort(kPortIndexOutput);
            }

            return BaseState::onOMXEvent(event, data1, data2);
        }

        default:
            return BaseState::onOMXEvent(event, data1, data2);
    }