Patch Detail
Show a patch.
GET /api/patches/12074/?format=api
{ "id": 12074, "url": "https://patchwork.libcamera.org/api/patches/12074/?format=api", "web_url": "https://patchwork.libcamera.org/patch/12074/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/projects/1/?format=api", "name": "libcamera", "link_name": "libcamera", "list_id": "libcamera_core", "list_email": "libcamera-devel@lists.libcamera.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20210422094102.371772-8-paul.elder@ideasonboard.com>", "date": "2021-04-22T09:40:57", "name": "[libcamera-devel,RFC,v2,07/12] android: camera_device: Set result metadata for FULL requirements", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "0a5a947f5733563dd56f1b04a8e001d71c83afbf", "submitter": { "id": 17, "url": "https://patchwork.libcamera.org/api/people/17/?format=api", "name": "Paul Elder", "email": "paul.elder@ideasonboard.com" }, "delegate": { "id": 17, "url": "https://patchwork.libcamera.org/api/users/17/?format=api", "username": "epaul", "first_name": "Paul", "last_name": "Elder", "email": "paul.elder@ideasonboard.com" }, "mbox": "https://patchwork.libcamera.org/patch/12074/mbox/", "series": [ { "id": 1962, "url": "https://patchwork.libcamera.org/api/series/1962/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1962", "date": "2021-04-22T09:40:50", "name": "FULL hardware level fixes", "version": 2, "mbox": "https://patchwork.libcamera.org/series/1962/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/12074/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/12074/checks/", "tags": {}, "headers": { "Return-Path": "<libcamera-devel-bounces@lists.libcamera.org>", "X-Original-To": "parsemail@patchwork.libcamera.org", "Delivered-To": "parsemail@patchwork.libcamera.org", "Received": [ "from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id EEF62BDB17\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 22 Apr 2021 09:41:28 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 890E76886A;\n\tThu, 22 Apr 2021 11:41:28 +0200 (CEST)", "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id BA3C06886A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 22 Apr 2021 11:41:25 +0200 (CEST)", "from pyrite.rasen.tech (unknown\n\t[IPv6:2400:4051:61:600:2c71:1b79:d06d:5032])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 6B6B73EE;\n\tThu, 22 Apr 2021 11:41:24 +0200 (CEST)" ], "Authentication-Results": "lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"ol8fDO0i\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1619084485;\n\tbh=JeADEKri/fxivXxPB3eygIXKGKrdC+F0/teuLg1JhNQ=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=ol8fDO0ifJRW4BhBD/LlwueBPOGbdj4cJIVHmOkFhPefvE3Yr3mZNAzSW54kyQpbs\n\tzrEZcwHLgcwcyLK3rrwM0otqMzp5P9Cin/g4YZRGf9om+2ksF1oncmq/mwHhrApcmW\n\tsqTo20/aoFxFXyCa6Nhj2PHzAjLLohJQvO8h1YxI=", "From": "Paul Elder <paul.elder@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Thu, 22 Apr 2021 18:40:57 +0900", "Message-Id": "<20210422094102.371772-8-paul.elder@ideasonboard.com>", "X-Mailer": "git-send-email 2.27.0", "In-Reply-To": "<20210422094102.371772-1-paul.elder@ideasonboard.com>", "References": "<20210422094102.371772-1-paul.elder@ideasonboard.com>", "MIME-Version": "1.0", "Subject": "[libcamera-devel] [RFC PATCH v2 07/12] android: camera_device: Set\n\tresult metadata for FULL requirements", "X-BeenThere": "libcamera-devel@lists.libcamera.org", "X-Mailman-Version": "2.1.29", "Precedence": "list", "List-Id": "<libcamera-devel.lists.libcamera.org>", "List-Unsubscribe": "<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>", "List-Archive": "<https://lists.libcamera.org/pipermail/libcamera-devel/>", "List-Post": "<mailto:libcamera-devel@lists.libcamera.org>", "List-Help": "<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>", "List-Subscribe": "<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>", "Content-Type": "text/plain; charset=\"us-ascii\"", "Content-Transfer-Encoding": "7bit", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "Set the result metadata to satisfy FULL hardware level requirements.\nAlso add the new result metadata tags to the static metadata.\n\nThis fixes many tests under:\n- android.hardware.camera2.cts.CaptureRequestTest\n - testAeModeAndLock\n - testAntiBandingModes\n - testAwbModeAndLock\n - testBlackLevelLock\n - testEdgeModeControlFastFps\n - testNoiseReductionModeControlFastFps\n - testToneMapControl\n- android.hardware.camera2.cts.CaptureResultTest\n - testCameraCaptureResultAllKeys\n- android.hardware.camera2.cts.ImageReaderTest\n - testDiscardFreeBuffers\n - testFlexibleYuv\n - testJpeg\n - testLongProcessingRepeatingFlexibleYuv\n - testRepeatingJpeg\n- android.hardware.camera2.cts.StaticMetadataTest\n - testCapabilities\n\nSigned-off-by: Paul Elder <paul.elder@ideasonboard.com>\n\n---\nAgain, not sure if the entries in the results key list needs to be added\nto the static metadata allocation size.\n---\n src/android/camera_device.cpp | 127 ++++++++++++++++++++++++++++++----\n src/android/camera_device.h | 2 +\n 2 files changed, 117 insertions(+), 12 deletions(-)", "diff": "diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp\nindex c9d4afc3..99c67555 100644\n--- a/src/android/camera_device.cpp\n+++ b/src/android/camera_device.cpp\n@@ -402,7 +402,7 @@ CameraDevice::Camera3RequestDescriptor::Camera3RequestDescriptor(\n \n CameraDevice::CameraDevice(unsigned int id, std::shared_ptr<Camera> camera)\n \t: id_(id), running_(false), camera_(std::move(camera)),\n-\t facing_(CAMERA_FACING_FRONT), orientation_(0)\n+\t facing_(CAMERA_FACING_FRONT), orientation_(0), lastTimestamp_(0)\n {\n \tcamera_->requestCompleted.connect(this, &CameraDevice::requestComplete);\n \n@@ -776,10 +776,10 @@ std::tuple<uint32_t, uint32_t> CameraDevice::calculateStaticMetadataSize()\n {\n \t/*\n \t * \\todo Keep this in sync with the actual number of entries.\n-\t * Currently: 63 entries, 990 bytes of static metadata\n+\t * Currently: 63 entries, 1014 bytes of static metadata\n \t */\n \tuint32_t numEntries = 63;\n-\tuint32_t byteSize = 990;\n+\tuint32_t byteSize = 1014;\n \n \t// do i need to add for entries in the available keys?\n \t// +1, +4 for EDGE_AVAILABLE_EDGE_MODES\n@@ -787,6 +787,7 @@ std::tuple<uint32_t, uint32_t> CameraDevice::calculateStaticMetadataSize()\n \t// +1, +4 for BLACK_LEVEL_PATTERN\n \t// +1, +4 for TONEMAP_AVAILABLE_TONE_MAP_MODES\n \t// +1, +4 for TONEMAP_MAX_CURVE_POINTS\n+\t// +4x9 = 36 for the new result tags\n \n \t// +36 for new request keys\n \n@@ -1419,8 +1420,9 @@ const camera_metadata_t *CameraDevice::getStaticMetadata()\n \t/*\n \t * required for FULL\n \t * \\todo get from camera (camCapabilities[camId]->tonemapCurvePoints?)\n+\t * at least 64\n \t */\n-\tint32_t tonemapCurvePoints = 0;\n+\tint32_t tonemapCurvePoints = 64;\n \tstaticMetadata_->addEntry(ANDROID_TONEMAP_MAX_CURVE_POINTS,\n \t\t\t\t &tonemapCurvePoints, 1);\n \n@@ -1526,6 +1528,9 @@ const camera_metadata_t *CameraDevice::getStaticMetadata()\n \t\tANDROID_SHADING_MODE,\n \t\tANDROID_STATISTICS_FACE_DETECT_MODE,\n \t\tANDROID_STATISTICS_LENS_SHADING_MAP_MODE,\n+\t\tANDROID_TONEMAP_CURVE_BLUE,\n+\t\tANDROID_TONEMAP_CURVE_GREEN,\n+\t\tANDROID_TONEMAP_CURVE_RED,\n \t\tANDROID_TONEMAP_MODE,\n \t};\n \tstaticMetadata_->addEntry(ANDROID_REQUEST_AVAILABLE_REQUEST_KEYS,\n@@ -1533,6 +1538,7 @@ const camera_metadata_t *CameraDevice::getStaticMetadata()\n \t\t\t\t availableRequestKeys.size());\n \n \tstd::vector<int32_t> availableResultKeys = {\n+\t\tANDROID_BLACK_LEVEL_LOCK,\n \t\tANDROID_COLOR_CORRECTION_ABERRATION_MODE,\n \t\tANDROID_CONTROL_AE_ANTIBANDING_MODE,\n \t\tANDROID_CONTROL_AE_EXPOSURE_COMPENSATION,\n@@ -1552,8 +1558,10 @@ const camera_metadata_t *CameraDevice::getStaticMetadata()\n \t\tANDROID_CONTROL_MODE,\n \t\tANDROID_CONTROL_SCENE_MODE,\n \t\tANDROID_CONTROL_VIDEO_STABILIZATION_MODE,\n+\t\tANDROID_EDGE_MODE,\n \t\tANDROID_FLASH_MODE,\n \t\tANDROID_FLASH_STATE,\n+\t\tANDROID_HOT_PIXEL_MODE,\n \t\tANDROID_JPEG_GPS_COORDINATES,\n \t\tANDROID_JPEG_GPS_PROCESSING_METHOD,\n \t\tANDROID_JPEG_GPS_TIMESTAMP,\n@@ -1563,20 +1571,30 @@ const camera_metadata_t *CameraDevice::getStaticMetadata()\n \t\tANDROID_JPEG_THUMBNAIL_QUALITY,\n \t\tANDROID_JPEG_THUMBNAIL_SIZE,\n \t\tANDROID_LENS_APERTURE,\n+\t\tANDROID_LENS_FILTER_DENSITY,\n \t\tANDROID_LENS_FOCAL_LENGTH,\n+\t\tANDROID_LENS_FOCUS_DISTANCE,\n+\t\tANDROID_LENS_FOCUS_RANGE, // undocumented\n \t\tANDROID_LENS_OPTICAL_STABILIZATION_MODE,\n \t\tANDROID_LENS_STATE,\n \t\tANDROID_NOISE_REDUCTION_MODE,\n \t\tANDROID_REQUEST_PIPELINE_DEPTH,\n \t\tANDROID_SCALER_CROP_REGION,\n \t\tANDROID_SENSOR_EXPOSURE_TIME,\n+\t\tANDROID_SENSOR_FRAME_DURATION,\n \t\tANDROID_SENSOR_ROLLING_SHUTTER_SKEW,\n+\t\tANDROID_SENSOR_SENSITIVITY,\n \t\tANDROID_SENSOR_TEST_PATTERN_MODE,\n \t\tANDROID_SENSOR_TIMESTAMP,\n+\t\tANDROID_SHADING_MODE,\n \t\tANDROID_STATISTICS_FACE_DETECT_MODE,\n \t\tANDROID_STATISTICS_LENS_SHADING_MAP_MODE,\n \t\tANDROID_STATISTICS_HOT_PIXEL_MAP_MODE,\n \t\tANDROID_STATISTICS_SCENE_FLICKER,\n+\t\tANDROID_TONEMAP_CURVE_BLUE,\n+\t\tANDROID_TONEMAP_CURVE_GREEN,\n+\t\tANDROID_TONEMAP_CURVE_RED,\n+\t\tANDROID_TONEMAP_MODE,\n \t};\n \tstaticMetadata_->addEntry(ANDROID_REQUEST_AVAILABLE_RESULT_KEYS,\n \t\t\t\t availableResultKeys.data(),\n@@ -2277,6 +2295,10 @@ void CameraDevice::requestComplete(Request *request)\n \n \tresultMetadata = getResultMetadata(descriptor);\n \n+\tconst ControlList &metadata = descriptor->request_->metadata();\n+\tif (metadata.contains(controls::SensorTimestamp))\n+\t\tlastTimestamp_ = metadata.get(controls::SensorTimestamp);\n+\n \t/* Handle any JPEG compression. */\n \tfor (camera3_stream_buffer_t &buffer : descriptor.buffers_) {\n \t\tCameraStream *cameraStream =\n@@ -2416,7 +2438,7 @@ CameraDevice::getResultMetadata(const Camera3RequestDescriptor &descriptor) cons\n \t * Total bytes for JPEG metadata: 82\n \t */\n \tstd::unique_ptr<CameraMetadata> resultMetadata =\n-\t\tstd::make_unique<CameraMetadata>(44, 166);\n+\t\tstd::make_unique<CameraMetadata>(57, 303);\n \tif (!resultMetadata->isValid()) {\n \t\tLOG(HAL, Error) << \"Failed to allocate result metadata\";\n \t\treturn nullptr;\n@@ -2428,6 +2450,11 @@ CameraDevice::getResultMetadata(const Camera3RequestDescriptor &descriptor) cons\n \t * from libcamera::Request::metadata.\n \t */\n \n+\t/* FULL */\n+\tfound = settings.getEntry(ANDROID_BLACK_LEVEL_LOCK, &entry);\n+\tbool valueBool = found ? *entry.data.u8 : false;\n+\tresultMetadata->addEntry(ANDROID_BLACK_LEVEL_LOCK, &valueBool, 1);\n+\n \tuint8_t value = ANDROID_COLOR_CORRECTION_ABERRATION_MODE_OFF;\n \tresultMetadata->addEntry(ANDROID_COLOR_CORRECTION_ABERRATION_MODE,\n \t\t\t\t &value, 1);\n@@ -2439,8 +2466,11 @@ CameraDevice::getResultMetadata(const Camera3RequestDescriptor &descriptor) cons\n \tresultMetadata->addEntry(ANDROID_CONTROL_AE_EXPOSURE_COMPENSATION,\n \t\t\t\t &value32, 1);\n \n+\t/* \\todo apply this */\n \tvalue = ANDROID_CONTROL_AE_LOCK_OFF;\n-\tresultMetadata->addEntry(ANDROID_CONTROL_AE_LOCK, &value, 1);\n+\tfound = settings.getEntry(ANDROID_CONTROL_AE_LOCK, &entry);\n+\tresultMetadata->addEntry(ANDROID_CONTROL_AE_LOCK,\n+\t\t\t\t found ? entry.data.u8 : &value, 1);\n \n \tvalue = ANDROID_CONTROL_AE_MODE_ON;\n \tresultMetadata->addEntry(ANDROID_CONTROL_AE_MODE, &value, 1);\n@@ -2472,12 +2502,16 @@ CameraDevice::getResultMetadata(const Camera3RequestDescriptor &descriptor) cons\n \tresultMetadata->addEntry(ANDROID_CONTROL_AF_TRIGGER, &value, 1);\n \n \tvalue = ANDROID_CONTROL_AWB_MODE_AUTO;\n-\tresultMetadata->addEntry(ANDROID_CONTROL_AWB_MODE, &value, 1);\n+\tfound = settings.getEntry(ANDROID_CONTROL_AWB_MODE, &entry);\n+\tresultMetadata->addEntry(ANDROID_CONTROL_AWB_MODE,\n+\t\t\t\t found ? entry.data.u8 : &value, 1);\n \n-\tvalue = ANDROID_CONTROL_AWB_LOCK_OFF;\n+\tfound = settings.getEntry(ANDROID_CONTROL_AWB_LOCK, &entry);\n+\tvalue = found ? *entry.data.u8 : ANDROID_CONTROL_AWB_LOCK_OFF;\n \tresultMetadata->addEntry(ANDROID_CONTROL_AWB_LOCK, &value, 1);\n \n-\tvalue = ANDROID_CONTROL_AWB_STATE_CONVERGED;\n+\tvalue = value ? ANDROID_CONTROL_AWB_STATE_LOCKED :\n+\t\t\tANDROID_CONTROL_AWB_STATE_CONVERGED;\n \tresultMetadata->addEntry(ANDROID_CONTROL_AWB_STATE, &value, 1);\n \n \tvalue = ANDROID_CONTROL_CAPTURE_INTENT_PREVIEW;\n@@ -2495,18 +2529,37 @@ CameraDevice::getResultMetadata(const Camera3RequestDescriptor &descriptor) cons\n \tvalue = ANDROID_CONTROL_VIDEO_STABILIZATION_MODE_OFF;\n \tresultMetadata->addEntry(ANDROID_CONTROL_VIDEO_STABILIZATION_MODE, &value, 1);\n \n+\tfound = settings.getEntry(ANDROID_EDGE_MODE, &entry);\n+\tvalue = found ? *entry.data.u8 : ANDROID_EDGE_MODE_OFF;\n+\tresultMetadata->addEntry(ANDROID_EDGE_MODE, &value, 1);\n+\n \tvalue = ANDROID_FLASH_MODE_OFF;\n \tresultMetadata->addEntry(ANDROID_FLASH_MODE, &value, 1);\n \n \tvalue = ANDROID_FLASH_STATE_UNAVAILABLE;\n \tresultMetadata->addEntry(ANDROID_FLASH_STATE, &value, 1);\n \n+\tvalue = ANDROID_HOT_PIXEL_MODE_OFF;\n+\tresultMetadata->addEntry(ANDROID_HOT_PIXEL_MODE, &value, 1);\n+\n \tif (settings.getEntry(ANDROID_LENS_APERTURE, &entry))\n \t\tresultMetadata->addEntry(ANDROID_LENS_APERTURE, entry.data.f, 1);\n \n+\tfloat filterDensity = 0.0f;\n+\tresultMetadata->addEntry(ANDROID_LENS_FILTER_DENSITY,\n+\t\t\t\t &filterDensity, 1);\n+\n \tfloat focal_length = 1.0;\n \tresultMetadata->addEntry(ANDROID_LENS_FOCAL_LENGTH, &focal_length, 1);\n \n+\tfloat focusDistance = 0.0f;\n+\tresultMetadata->addEntry(ANDROID_LENS_FOCUS_DISTANCE,\n+\t\t\t\t &focusDistance, 1);\n+\n+\t/* there's no documentation on this */\n+\tfloat focusRange[] = { 0.0f, 1.0f };\n+\tresultMetadata->addEntry(ANDROID_LENS_FOCUS_RANGE, &focusRange, 2);\n+\n \tvalue = ANDROID_LENS_STATE_STATIONARY;\n \tresultMetadata->addEntry(ANDROID_LENS_STATE, &value, 1);\n \n@@ -2518,6 +2571,11 @@ CameraDevice::getResultMetadata(const Camera3RequestDescriptor &descriptor) cons\n \tresultMetadata->addEntry(ANDROID_SENSOR_TEST_PATTERN_MODE,\n \t\t\t\t &value32, 1);\n \n+\n+\t/* \\todo get this from request? and set it. handle map mode too */\n+\tvalue = ANDROID_SHADING_MODE_OFF;\n+\tresultMetadata->addEntry(ANDROID_SHADING_MODE, &value, 1);\n+\n \tvalue = ANDROID_STATISTICS_FACE_DETECT_MODE_OFF;\n \tresultMetadata->addEntry(ANDROID_STATISTICS_FACE_DETECT_MODE,\n \t\t\t\t &value, 1);\n@@ -2534,14 +2592,48 @@ CameraDevice::getResultMetadata(const Camera3RequestDescriptor &descriptor) cons\n \tresultMetadata->addEntry(ANDROID_STATISTICS_SCENE_FLICKER,\n \t\t\t\t &value, 1);\n \n+\t/* \\todo handle this */\n+\tfound = settings.getEntry(ANDROID_TONEMAP_MODE, &entry);\n+\tvalue = found ? *entry.data.u8 : ANDROID_TONEMAP_MODE_FAST;\n+\tresultMetadata->addEntry(ANDROID_TONEMAP_MODE, &value, 1);\n+\n \tvalue = ANDROID_NOISE_REDUCTION_MODE_OFF;\n-\tresultMetadata->addEntry(ANDROID_NOISE_REDUCTION_MODE, &value, 1);\n+\tfound = settings.getEntry(ANDROID_NOISE_REDUCTION_MODE, &entry);\n+\tresultMetadata->addEntry(ANDROID_NOISE_REDUCTION_MODE,\n+\t\t\t\t found ? entry.data.u8 : &value, 1);\n \n \t/* 33.3 msec */\n \tconst int64_t rolling_shutter_skew = 33300000;\n \tresultMetadata->addEntry(ANDROID_SENSOR_ROLLING_SHUTTER_SKEW,\n \t\t\t\t &rolling_shutter_skew, 1);\n \n+\t/*\n+\t * CTS doesn't actually check if this is equal to the requested\n+\t * tonemap, so just set a linear tonemap\n+\t * it's in [in, out] [in, out] format\n+\t */\n+\tstd::vector<float> tonemap = {\n+\t\t0.0, 0.0,\n+\t\t1.0, 1.0,\n+\t};\n+\tresultMetadata->addEntry(ANDROID_TONEMAP_CURVE_BLUE,\n+\t\t\t\t tonemap.data(), tonemap.size());\n+\tresultMetadata->addEntry(ANDROID_TONEMAP_CURVE_GREEN,\n+\t\t\t\t tonemap.data(), tonemap.size());\n+\tresultMetadata->addEntry(ANDROID_TONEMAP_CURVE_RED,\n+\t\t\t\t tonemap.data(), tonemap.size());\n+\n+\t/*\n+\t * \\todo get the tonemap gamma and tonemap preset curve from request\n+\t * and copy to result\n+\t */\n+\n+\t/* \\todo get this from camera */\n+\tvalue32 = 32;\n+\tfound = settings.getEntry(ANDROID_SENSOR_SENSITIVITY, &entry);\n+\tresultMetadata->addEntry(ANDROID_SENSOR_SENSITIVITY,\n+\t\t\t\t found ? entry.data.i32 : &value32, 1);\n+\n \t/* Add metadata tags reported by libcamera. */\n \tif (metadata.contains(controls::draft::PipelineDepth)) {\n \t\tuint8_t pipeline_depth =\n@@ -2550,15 +2642,26 @@ CameraDevice::getResultMetadata(const Camera3RequestDescriptor &descriptor) cons\n \t\t\t\t\t &pipeline_depth, 1);\n \t}\n \n-\tif (metadata.contains(controls::ExposureTime)) {\n+\tfound = settings.getEntry(ANDROID_SENSOR_EXPOSURE_TIME, &entry);\n+\tif (found || metadata.contains(controls::ExposureTime)) {\n \t\tint64_t exposure = metadata.get(controls::ExposureTime) * 1000ULL;\n \t\tresultMetadata->addEntry(ANDROID_SENSOR_EXPOSURE_TIME,\n-\t\t\t\t\t &exposure, 1);\n+\t\t\t\t\t found ? entry.data.i64 : &exposure, 1);\n \t}\n \n \tif (metadata.contains(controls::SensorTimestamp)) {\n \t\tint64_t timestamp = metadata.get(controls::SensorTimestamp);\n \t\tresultMetadata->addEntry(ANDROID_SENSOR_TIMESTAMP, ×tamp, 1);\n+\n+\t\tint64_t frameDuration = timestamp - lastTimestamp_;\n+\t\t/*\n+\t\t * frame duration should be at last as long as the requested\n+\t\t * exposure time, hardcode it for now\n+\t\t */\n+\t\tif (found && frameDuration < *entry.data.i64)\n+\t\t\tframeDuration = *entry.data.i64;\n+\t\tresultMetadata->addEntry(ANDROID_SENSOR_FRAME_DURATION,\n+\t\t\t\t\t &frameDuration, 1);\n \t}\n \n \tif (metadata.contains(controls::ScalerCrop)) {\ndiff --git a/src/android/camera_device.h b/src/android/camera_device.h\nindex 8edbcdfd..fcd57fcd 100644\n--- a/src/android/camera_device.h\n+++ b/src/android/camera_device.h\n@@ -139,6 +139,8 @@ private:\n \n \tunsigned int maxJpegBufferSize_;\n \n+\tint64_t lastTimestamp_;\n+\n \tCameraMetadata lastSettings_;\n };\n \n", "prefixes": [ "libcamera-devel", "RFC", "v2", "07/12" ] }