{"id":11020,"url":"https://patchwork.libcamera.org/api/1.1/patches/11020/?format=json","web_url":"https://patchwork.libcamera.org/patch/11020/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20210126173008.446321-5-jacopo@jmondi.org>","date":"2021-01-26T17:30:06","name":"[libcamera-devel,v2,4/6] fixup! android: camera_device: Compute frame durations","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"41d0d7f16c33935607d0d74b00251c41a36414b1","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/1.1/people/3/?format=json","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/11020/mbox/","series":[{"id":1612,"url":"https://patchwork.libcamera.org/api/1.1/series/1612/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=1612","date":"2021-01-26T17:30:02","name":"android: Report frame durations","version":2,"mbox":"https://patchwork.libcamera.org/series/1612/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/11020/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/11020/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 15369BD808\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 26 Jan 2021 17:29:59 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 048BA68334;\n\tTue, 26 Jan 2021 18:29:58 +0100 (CET)","from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net\n\t[217.70.183.196])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 9C1BD6831B\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 26 Jan 2021 18:29:54 +0100 (CET)","from uno.lan (93-34-118-233.ip49.fastwebnet.it [93.34.118.233])\n\t(Authenticated sender: jacopo@jmondi.org)\n\tby relay4-d.mail.gandi.net (Postfix) with ESMTPSA id 66E57E000A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 26 Jan 2021 17:29:54 +0000 (UTC)"],"X-Originating-IP":"93.34.118.233","From":"Jacopo Mondi <jacopo@jmondi.org>","To":"libcamera-devel@lists.libcamera.org","Date":"Tue, 26 Jan 2021 18:30:06 +0100","Message-Id":"<20210126173008.446321-5-jacopo@jmondi.org>","X-Mailer":"git-send-email 2.30.0","In-Reply-To":"<20210126173008.446321-1-jacopo@jmondi.org>","References":"<20210126173008.446321-1-jacopo@jmondi.org>","MIME-Version":"1.0","Subject":"[libcamera-devel] [PATCH v2 4/6] fixup! android: camera_device:\n\tCompute frame durations","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":"---\n src/android/camera_device.cpp | 20 ++++++++++++++++++++\n 1 file changed, 20 insertions(+)","diff":"diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp\nindex e3d43bea4700..5a8072a8a007 100644\n--- a/src/android/camera_device.cpp\n+++ b/src/android/camera_device.cpp\n@@ -768,6 +768,26 @@ const camera_metadata_t *CameraDevice::getStaticMetadata()\n \t\tminFrameDurationUsec = frameDurationsInfo->second.min().get<int64_t>();\n \t\tmaxFrameDurationUsec = frameDurationsInfo->second.max().get<int64_t>();\n \n+\t\t/*\n+\t\t * Adjust the minimum frame duration to comply with Android\n+\t\t * requirements. The camera service mandates all preview/record\n+\t\t * streams to have a minimum frame duration < 33,366 milliseconds\n+\t\t * (see MAX_PREVIEW_RECORD_DURATION_NS in the camera service\n+\t\t * implementation).\n+\t\t *\n+\t\t * If we're close enough (+- 500 useconds) to that value round\n+\t\t * the minimum frame duration of the camera to an accepted\n+\t\t * value.\n+\t\t */\n+\t\tstatic constexpr double MIN_PREVIEW_RECORD_FPS = 29.97;\n+\t\tstatic constexpr int64_t MAX_PREVIEW_RECORD_DURATION_US = 1e6 / MIN_PREVIEW_RECORD_FPS;\n+\t\tif (minFrameDurationUsec > MAX_PREVIEW_RECORD_DURATION_US) {\n+\t\t\tdouble frameDurationDelta = minFrameDurationUsec -\n+\t\t\t\t\t\t    MAX_PREVIEW_RECORD_DURATION_US;\n+\t\t\tif (frameDurationDelta < 500)\n+\t\t\t\tminFrameDurationUsec = MAX_PREVIEW_RECORD_DURATION_US - 1;\n+\t\t}\n+\n \t\t/*\n \t\t * The AE routine frame rate limits are computed using the frame\n \t\t * duration limits, as libcamera clips the AE routine to the\n","prefixes":["libcamera-devel","v2","4/6"]}