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

Commit 9501a1e1 authored by Sai Kumar Sanagavarapu's avatar Sai Kumar Sanagavarapu Committed by Linux Build Service Account
Browse files

camera: Fix memory leak in stop recording usecase.

Issue:
1. In CameraSource, if both recording proxy and local camera
   instances are null, the frames which are supposed to be
   returned back to Camera, will never be returned, causing
   memory leak.
2. If a frame is returned from CameraSource after stop recording
   is issued, Camera HAL cannot handle it because by that time
   it will be previewing state.

Fix:
1. Since camera handles are not available, close the native handle
   in CameraSource itself.
2. Close the duped native handles in cameraservice instead of
   delegating the responsibility to Camera HAL.

Bug: 30299751
CRs-Fixed: 1040448
Change-Id: I45a351d0813dff15034fa25b79987ceab07232bb
parent 7bf07b34
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -1138,6 +1138,9 @@ void CameraSource::releaseRecordingFrameHandle(native_handle_t* handle) {
        int64_t token = IPCThreadState::self()->clearCallingIdentity();
        mCamera->releaseRecordingFrameHandle(handle);
        IPCThreadState::self()->restoreCallingIdentity(token);
    } else {
        native_handle_close(handle);
        native_handle_delete(handle);
    }
}

+3 −0
Original line number Diff line number Diff line
@@ -523,6 +523,9 @@ void CameraClient::releaseRecordingFrameHandle(native_handle_t *handle) {
    metadata->pHandle = handle;

    mHardware->releaseRecordingFrame(dataPtr);

    native_handle_close(handle);
    native_handle_delete(handle);
}

status_t CameraClient::setVideoBufferMode(int32_t videoBufferMode) {