Patch Detail
Show a patch.
GET /api/1.1/patches/16730/?format=api
{ "id": 16730, "url": "https://patchwork.libcamera.org/api/1.1/patches/16730/?format=api", "web_url": "https://patchwork.libcamera.org/patch/16730/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/1.1/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": "<20220722070600.2949278-2-chenghaoyang@google.com>", "date": "2022-07-22T07:06:00", "name": "[libcamera-devel,v2,1/1] Fix Android adaptor thumbnail buffer lifetime", "commit_ref": "74794de987c069250deba03c1a55ccd6f659e9e8", "pull_url": null, "state": "accepted", "archived": false, "hash": "a2cf001bd967f65a4a93671f21feaf23c8d322de", "submitter": { "id": 117, "url": "https://patchwork.libcamera.org/api/1.1/people/117/?format=api", "name": "Cheng-Hao Yang", "email": "chenghaoyang@chromium.org" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/16730/mbox/", "series": [ { "id": 3317, "url": "https://patchwork.libcamera.org/api/1.1/series/3317/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3317", "date": "2022-07-22T07:05:59", "name": "Android adaptor thumbnail buffer lifetime issue", "version": 2, "mbox": "https://patchwork.libcamera.org/series/3317/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/16730/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/16730/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 93028BE173\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 22 Jul 2022 07:06:13 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 4A7F463316;\n\tFri, 22 Jul 2022 09:06:13 +0200 (CEST)", "from mail-pj1-x1036.google.com (mail-pj1-x1036.google.com\n\t[IPv6:2607:f8b0:4864:20::1036])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 12E7563314\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 22 Jul 2022 09:06:11 +0200 (CEST)", "by mail-pj1-x1036.google.com with SMTP id\n\tf3-20020a17090ac28300b001f22d62bfbcso2947945pjt.0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 22 Jul 2022 00:06:10 -0700 (PDT)", "from chenghaoyang-low.c.googlers.com.com\n\t(231.137.80.34.bc.googleusercontent.com. [34.80.137.231])\n\tby smtp.gmail.com with ESMTPSA id\n\tgb17-20020a17090b061100b001f1694dafb1sm2550114pjb.44.2022.07.22.00.06.06\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tFri, 22 Jul 2022 00:06:07 -0700 (PDT)" ], "DKIM-Signature": [ "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1658473573;\n\tbh=uTkJjKLyCGBRwLxl90OBLJclYUGohYZrWKSBG7LOQ/g=;\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=rgiPjOuAwnx+qMNJaJOzU9xj7vmkmZs3usB7WHbCexJ708vYZKIDaFh6OtGd/yU2l\n\tGtM5OoJu5K2pkC77ewztDdTEOqGCXV0LInbEnd/Lqwr6CxLBkB6JoEJdtQXvaZws9s\n\tLOo82YXsfkSk/ytlCkiJ50bKkyYeYZqt3LN/0aUCGr157WH165cW0J7HIGIy7DPkU+\n\ta0lbrKKvIu54ImxiuRPqbOFqKEHBKmsUMYgLrgjhhrN3alyCPqoOG4A1d+JuFzCDM2\n\tPnX56K4Vrw5z0soAOOKMOnJBr/GfajjZ/LZfKE6J1PsCokinH/4H9ax+V+aYF1ooNS\n\t7BI9W9s1/iPFw==", "v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org;\n\ts=google; \n\th=from:to:cc:subject:date:message-id:in-reply-to:references\n\t:mime-version:content-transfer-encoding;\n\tbh=hDzaxcpCSe7hnLy8+MtAtKRsCENOi94QnmmHgCqkDXQ=;\n\tb=Tu5izpkLTLgFz4GkmQuyQrMNBElBlCnCjEz0pt1MxgEP8nfHEG6IHHUw2yod9X2G3M\n\tz3T3tZRzzjop12HWDPXt+g5rX/wB5owIKPzcTJ+8CqCP9NokKMQ1ICJRJqlx/ughByb5\n\tWz8VRYZkvzz8zNofmLVx6Wa6xYKK+UYc3RUOc=" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=chromium.org\n\theader.i=@chromium.org header.b=\"Tu5izpkL\"; \n\tdkim-atps=neutral", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references:mime-version:content-transfer-encoding;\n\tbh=hDzaxcpCSe7hnLy8+MtAtKRsCENOi94QnmmHgCqkDXQ=;\n\tb=wMDndqv3j2a6lL60Re1r1bOdvh8IaTENwNo5i+8p3V5s20BhtZcTNtB7IxDGnYmMy8\n\txS0gx74VW4BycE0k+sck8HHjefQg4mcutBkiMzcBKqAlbpniedpwXOUyPb8F9WmtndxR\n\tSJQIABXM7Ru7vWjQ/7rlj/wZJ9KuOoqRVjUe1svbJ06UnKHbGhCj/zFs1FeXb4oYaIqF\n\t7dNOeyteJOBB7buGxh19qdapVN6Yv+fKc/5y3aLKxmBSo0+8Gz5QaHKa8rLHmivMGjl4\n\tejZOOLMznNJzXun3LOxcJPPjnwl/1t9BJcBvYTxQMbdqObzIEr4M6wb1kAbtFAndl1pZ\n\tnh8w==", "X-Gm-Message-State": "AJIora8LSDa4N2+gWfhLoFbxj1I+g1DcIqIc/b6/PiOUnkykSo2vYJZM\n\t0pLtTNATYP9jWBXJrceKAJoRg2O3rpWe5Aq0", "X-Google-Smtp-Source": "AGRyM1sTg9sgU2PQkhHCF9htSHKkRco5fVtMXDKju6/O8lEefEkLQDDghImzfQ8bvRvic7jrLkpLcg==", "X-Received": "by 2002:a17:90b:1bc1:b0:1f0:3830:8c99 with SMTP id\n\toa1-20020a17090b1bc100b001f038308c99mr15975282pjb.1.1658473569039; \n\tFri, 22 Jul 2022 00:06:09 -0700 (PDT)", "X-Google-Original-From": "Harvey Yang <chenghaoyang@google.com>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Fri, 22 Jul 2022 07:06:00 +0000", "Message-Id": "<20220722070600.2949278-2-chenghaoyang@google.com>", "X-Mailer": "git-send-email 2.37.1.359.gd136c6c3e2-goog", "In-Reply-To": "<20220722070600.2949278-1-chenghaoyang@google.com>", "References": "<20220722070600.2949278-1-chenghaoyang@google.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v2 1/1] Fix Android adaptor thumbnail\n\tbuffer lifetime", "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>", "From": "Harvey Yang via libcamera-devel <libcamera-devel@lists.libcamera.org>", "Reply-To": "Harvey Yang <chenghaoyang@chromium.org>", "Cc": "Harvey Yang <chenghaoyang@google.com>,\n\tHarvey Yang <chenghaoyang@chromium.org>", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "Previously the thumbnail buffer is destructed before even being used in\nExif. This patch moves the buffer into class Exif, so that the developer\nwon't need to worry about its lifetime.\n\nSigned-off-by: Harvey Yang <chenghaoyang@chromium.org>\n---\n src/android/jpeg/exif.cpp | 13 +++++--------\n src/android/jpeg/exif.h | 5 ++++-\n src/android/jpeg/post_processor_jpeg.cpp | 2 +-\n 3 files changed, 10 insertions(+), 10 deletions(-)", "diff": "diff --git a/src/android/jpeg/exif.cpp b/src/android/jpeg/exif.cpp\nindex 3220b458..6b1d0f1f 100644\n--- a/src/android/jpeg/exif.cpp\n+++ b/src/android/jpeg/exif.cpp\n@@ -430,16 +430,13 @@ void Exif::setOrientation(int orientation)\n \tsetShort(EXIF_IFD_0, EXIF_TAG_ORIENTATION, value);\n }\n \n-/*\n- * The thumbnail data should remain valid until the Exif object is destroyed.\n- * Failing to do so, might result in no thumbnail data being set even after a\n- * call to Exif::setThumbnail().\n- */\n-void Exif::setThumbnail(Span<const unsigned char> thumbnail,\n+void Exif::setThumbnail(std::vector<unsigned char> &&thumbnail,\n \t\t\tCompression compression)\n {\n-\tdata_->data = const_cast<unsigned char *>(thumbnail.data());\n-\tdata_->size = thumbnail.size();\n+\tthumbnailData_ = std::move(thumbnail);\n+\n+\tdata_->data = thumbnailData_.data();\n+\tdata_->size = thumbnailData_.size();\n \n \tsetShort(EXIF_IFD_0, EXIF_TAG_COMPRESSION, compression);\n }\ndiff --git a/src/android/jpeg/exif.h b/src/android/jpeg/exif.h\nindex 2ff8fb78..e68716f3 100644\n--- a/src/android/jpeg/exif.h\n+++ b/src/android/jpeg/exif.h\n@@ -10,6 +10,7 @@\n #include <chrono>\n #include <string>\n #include <time.h>\n+#include <vector>\n \n #include <libexif/exif-data.h>\n \n@@ -60,7 +61,7 @@ public:\n \n \tvoid setOrientation(int orientation);\n \tvoid setSize(const libcamera::Size &size);\n-\tvoid setThumbnail(libcamera::Span<const unsigned char> thumbnail,\n+\tvoid setThumbnail(std::vector<unsigned char> &&thumbnail,\n \t\t\t Compression compression);\n \tvoid setTimestamp(time_t timestamp, std::chrono::milliseconds msec);\n \n@@ -106,4 +107,6 @@ private:\n \n \tunsigned char *exifData_;\n \tunsigned int size_;\n+\n+\tstd::vector<unsigned char> thumbnailData_;\n };\ndiff --git a/src/android/jpeg/post_processor_jpeg.cpp b/src/android/jpeg/post_processor_jpeg.cpp\nindex d72ebc3c..0cf56716 100644\n--- a/src/android/jpeg/post_processor_jpeg.cpp\n+++ b/src/android/jpeg/post_processor_jpeg.cpp\n@@ -166,7 +166,7 @@ void PostProcessorJpeg::process(Camera3RequestDescriptor::StreamBuffer *streamBu\n \t\t\tstd::vector<unsigned char> thumbnail;\n \t\t\tgenerateThumbnail(source, thumbnailSize, quality, &thumbnail);\n \t\t\tif (!thumbnail.empty())\n-\t\t\t\texif.setThumbnail(thumbnail, Exif::Compression::JPEG);\n+\t\t\t\texif.setThumbnail(std::move(thumbnail), Exif::Compression::JPEG);\n \t\t}\n \n \t\tresultMetadata->addEntry(ANDROID_JPEG_THUMBNAIL_SIZE, data, 2);\n", "prefixes": [ "libcamera-devel", "v2", "1/1" ] }