{"id":11731,"url":"https://patchwork.libcamera.org/api/1.1/patches/11731/?format=json","web_url":"https://patchwork.libcamera.org/patch/11731/","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":"<CAO4hSri3GgJcDqrfpWfUtP5i16BZog6tWn2z06QhCMFF3dXLgQ@mail.gmail.com>","date":"2021-03-26T16:26:24","name":"[libcamera-devel] android: CameraDevice: Add existing check for ScalerCrop control","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"814208963e45c2220ce136a2ed53607c6be0909f","submitter":{"id":79,"url":"https://patchwork.libcamera.org/api/1.1/people/79/?format=json","name":"Phi-bang Nguyen","email":"pnguyen@baylibre.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/11731/mbox/","series":[{"id":1840,"url":"https://patchwork.libcamera.org/api/1.1/series/1840/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=1840","date":"2021-03-26T16:26:24","name":"[libcamera-devel] android: CameraDevice: Add existing check for ScalerCrop control","version":1,"mbox":"https://patchwork.libcamera.org/series/1840/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/11731/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/11731/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 11E22C32EB\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 26 Mar 2021 16:26:39 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 525A168D6B;\n\tFri, 26 Mar 2021 17:26:38 +0100 (CET)","from mail-io1-xd2e.google.com (mail-io1-xd2e.google.com\n\t[IPv6:2607:f8b0:4864:20::d2e])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 493626051A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 26 Mar 2021 17:26:37 +0100 (CET)","by mail-io1-xd2e.google.com with SMTP id b10so5980532iot.4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 26 Mar 2021 09:26:37 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=baylibre-com.20150623.gappssmtp.com\n\theader.i=@baylibre-com.20150623.gappssmtp.com\n\theader.b=\"xI7HkL99\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=baylibre-com.20150623.gappssmtp.com; s=20150623;\n\th=mime-version:from:date:message-id:subject:to:cc;\n\tbh=lj8II5XTXdxeoJyWnInWA8NsIrMhImdPTAyw7GWAw3w=;\n\tb=xI7HkL99lEQxM1djXve6y1/k9RajDyrA6tVmSwk7cUXlIiKmzQUmk59lEFsY/zTshV\n\tsQ1yeA9bjdcQZeH4+uoemX952AWZVRJcg/95lVmxC51L5tXC0O4CEhEEd5pLhQAE8Fac\n\tJnDD5z4LJ21wlgAQqQWfQljTnwmnCKoEP/fB7/PW57mdYVkx6YfWKiRISROrwSAJvzD8\n\t9MS8VEXDydd0RfgyURQJ61M7iKiVCeK20Hf9x/r1tzBypjId7AMuI+5KkOsFEV0qlMml\n\tduvrSIANDOPBS01n6qbehIZ2V4gD3Ms1rc7FDdOuXZWlEydH09a9QvPEwN88zX/aWgY9\n\toIPg==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:mime-version:from:date:message-id:subject:to:cc; \n\tbh=lj8II5XTXdxeoJyWnInWA8NsIrMhImdPTAyw7GWAw3w=;\n\tb=qWdZhKqjqPCo/Nm6t8RQkB89fimyK/li3FLd9Z9mngfDgbnJa/pZ0YC7OCMcdDkNsc\n\tRdgEIiLlQL9mnqS064+cpYxe7xXy6Zlkdz33KWDEgqqHCSJLEgnDiqDnlsriXeVfCyEY\n\twrb6QHJJ1s3/KFVmsdX5b/YDW3OAJS1U+T1o3M8v5mWi+fi5n9pUHqofDvkckPy3pG8k\n\tsPYCVWUzu0T/WZHTKx21YTO3jq2OrePNkoPVwmIgI4yvul0M/emSqjusKyfwnQWVlT6Q\n\te0yrM8MmJyTDzEmif/L/1i/42vT53L3P3LGJi6+jkfAu9uCuhjXf6AskQvQB+pbivipT\n\tKV1w==","X-Gm-Message-State":"AOAM5306RgkHzVYLQJvdCf4EsKluYVaDdexLMPdzC+VPjnJedSBHCNVT\n\tnoaiNA6LY6uyjz8jbVP5L15R4noVFq72I/bjQNjvCJSoxbIJSQ==","X-Google-Smtp-Source":"ABdhPJxMlC6ICxbKarQ7DWK+ygAdaiySowOVZOm0IJZUbh194FDH9oKVdmtcrGQnou3npQxtnrqr1llxhOCaJ6aQ4/Q=","X-Received":"by 2002:a6b:3bc7:: with SMTP id\n\ti190mr11098216ioa.163.1616775995845; \n\tFri, 26 Mar 2021 09:26:35 -0700 (PDT)","MIME-Version":"1.0","From":"Phi-bang Nguyen <pnguyen@baylibre.com>","Date":"Fri, 26 Mar 2021 17:26:24 +0100","Message-ID":"<CAO4hSri3GgJcDqrfpWfUtP5i16BZog6tWn2z06QhCMFF3dXLgQ@mail.gmail.com>","To":"libcamera-devel@lists.libcamera.org","Subject":"[libcamera-devel] [PATCH] android: CameraDevice: Add existing check\n\tfor ScalerCrop control","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":"multipart/mixed;\n\tboundary=\"===============6554047783192862255==\"","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"The ScalerCrop control does not contain the existing check which can\ncause the camera HAL crash at boot. Fix it.\n\nSigned-off-by: Phi-Bang Nguyen <pnguyen@baylibre.com>\n---\n src/android/camera_device.cpp | 9 ++++++---\n 1 file changed, 6 insertions(+), 3 deletions(-)\n\n  }\n\n--\nRegards\n\nPhi-Bang","diff":"diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp\nindex ae693664..678bfff8 100644\n--- a/src/android/camera_device.cpp\n+++ b/src/android/camera_device.cpp\n@@ -1107,11 +1107,14 @@ const camera_metadata_t\n*CameraDevice::getStaticMetadata()\n  * use the maximum and minimum crop rectangles to calculate the\n  * digital zoom factor.\n  */\n+ float maxZoom = {1};\n  const auto info = controlsInfo.find(&controls::ScalerCrop);\n- Rectangle min = info->second.min().get<Rectangle>();\n- Rectangle max = info->second.max().get<Rectangle>();\n- float maxZoom = std::min(1.0f * max.width / min.width,\n+ if (info != controlsInfo.end()) {\n+ Rectangle min = info->second.min().get<Rectangle>();\n+ Rectangle max = info->second.max().get<Rectangle>();\n+ maxZoom = std::min(1.0f * max.width / min.width,\n  1.0f * max.height / min.height);\n+ }\n  staticMetadata_->addEntry(ANDROID_SCALER_AVAILABLE_MAX_DIGITAL_ZOOM,\n   &maxZoom, 1);\n","prefixes":["libcamera-devel"]}