Camera: use compact copy when necessary
When camera HAL sends redundant metadata (reserved space >> actual
used space), create a compact copy to save IPC overhead.
Test: Camera CTS/camera app smoke test
Bug: 79838637
Change-Id: I02657deb377c43c65d111d1fc894eb3c20ad3b8f
diff --git a/camera/device/3.2/default/CameraDeviceSession.h b/camera/device/3.2/default/CameraDeviceSession.h
index 269cc06..af90e5a 100644
--- a/camera/device/3.2/default/CameraDeviceSession.h
+++ b/camera/device/3.2/default/CameraDeviceSession.h
@@ -141,7 +141,7 @@
};
camera3_device_t* mDevice;
- uint32_t mDeviceVersion;
+ const uint32_t mDeviceVersion;
bool mIsAELockAvailable;
bool mDerivePostRawSensKey;
uint32_t mNumPartialResults;
@@ -329,6 +329,17 @@
status_t constructCaptureResult(CaptureResult& result,
const camera3_capture_result *hal_result);
+
+ // Static helper method to copy/shrink capture result metadata sent by HAL
+ // Temporarily allocated metadata copy will be hold in mds
+ static void sShrinkCaptureResult(
+ camera3_capture_result* dst, const camera3_capture_result* src,
+ std::vector<::android::hardware::camera::common::V1_0::helper::CameraMetadata>* mds,
+ std::vector<const camera_metadata_t*>* physCamMdArray,
+ bool handlePhysCam);
+ static bool sShouldShrink(const camera_metadata_t* md);
+ static camera_metadata_t* sCreateCompactCopy(const camera_metadata_t* src);
+
private:
struct TrampolineSessionInterface_3_2 : public ICameraDeviceSession {