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

Commit 23619bac authored by Milos Ratkovic's avatar Milos Ratkovic Committed by Adrian DC
Browse files

Camera: check metadata type before releasing frame

Hidl method releaseRecordingFrameHandle fails for metadata
type other than kMetadataBufferTypeNativeHandleSource which
prevents older devices to record video.

Change-Id: I0e84883bdb636e965526ca1282216baef43e87e8
parent 83673604
Loading
Loading
Loading
Loading
+10 −6
Original line number Diff line number Diff line
@@ -595,6 +595,7 @@ void CameraHardwareInterface::releaseRecordingFrame(const sp<IMemory>& mem)
    if (CC_LIKELY(mHidlDevice != nullptr)) {
        if (size == sizeof(VideoNativeHandleMetadata)) {
            VideoNativeHandleMetadata* md = (VideoNativeHandleMetadata*) mem->pointer();
            if (md->eType == kMetadataBufferTypeNativeHandleSource) {
                // Caching the handle here because md->pHandle will be subject to HAL's edit
                native_handle_t* nh = md->pHandle;
                hidl_handle frame = nh;
@@ -604,6 +605,9 @@ void CameraHardwareInterface::releaseRecordingFrame(const sp<IMemory>& mem)
            } else {
                mHidlDevice->releaseRecordingFrame(heapId, bufferIndex);
            }
        } else {
            mHidlDevice->releaseRecordingFrame(heapId, bufferIndex);
        }
    }
}