Patch Detail
Show a patch.
GET /api/patches/23427/?format=api
{ "id": 23427, "url": "https://patchwork.libcamera.org/api/patches/23427/?format=api", "web_url": "https://patchwork.libcamera.org/patch/23427/", "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": "<20250522125521.6465-5-laurent.pinchart@ideasonboard.com>", "date": "2025-05-22T12:55:21", "name": "[4/4] gstreamer: Reduce indentation in gst_libcamera_create_video_pool()", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "c54c2bf23db3571202725f26fa1d23193058e535", "submitter": { "id": 2, "url": "https://patchwork.libcamera.org/api/people/2/?format=api", "name": "Laurent Pinchart", "email": "laurent.pinchart@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/23427/mbox/", "series": [ { "id": 5190, "url": "https://patchwork.libcamera.org/api/series/5190/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=5190", "date": "2025-05-22T12:55:17", "name": "gstreamer: Miscellaneous cleanups + one fix", "version": 1, "mbox": "https://patchwork.libcamera.org/series/5190/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/23427/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/23427/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 ABC40BD78E\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 22 May 2025 12:55:36 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 34DE268D9E;\n\tThu, 22 May 2025 14:55:36 +0200 (CEST)", "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 97D8268D99\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 22 May 2025 14:55:31 +0200 (CEST)", "from pendragon.ideasonboard.com\n\t(179.218-130-109.adsl-dyn.isp.belgacom.be [109.130.218.179])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 99F858FA;\n\tThu, 22 May 2025 14:55:09 +0200 (CEST)" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"m6tUgBoB\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1747918509;\n\tbh=/p9u7AIo1eFd/X4+Appf5FWNuQZOJdvieo4vadrqmI4=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=m6tUgBoB237ZiKtiQIFloVkAYR10jpZseQht3EVxeIa29tzv7veWQNq944sjAoEYr\n\tvONzov2Bt4Z1Ym+jw5Ge3OT0d1vqddZ7kQ6MgYRka1sHtFtouBBfuBq+vhBHVO0Rr2\n\tzjuGnUXeEWsEbXIVQ6jJztR3RVuFbJkZ8fnXMTGc=", "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Cc": "Hou Qi <qi.hou@nxp.com>,\n\tNicolas Dufresne <nicolas.dufresne@collabora.com>", "Subject": "[PATCH 4/4] gstreamer: Reduce indentation in\n\tgst_libcamera_create_video_pool()", "Date": "Thu, 22 May 2025 14:55:21 +0200", "Message-ID": "<20250522125521.6465-5-laurent.pinchart@ideasonboard.com>", "X-Mailer": "git-send-email 2.49.0", "In-Reply-To": "<20250522125521.6465-1-laurent.pinchart@ideasonboard.com>", "References": "<20250522125521.6465-1-laurent.pinchart@ideasonboard.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "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>", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "Now that video pool creation is handled by a dedicated function, the\nlogic can be simplified by returning early instead of nesting scopes. Do\nso to decrease indentation and improve readability.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/gstreamer/gstlibcamerasrc.cpp | 50 ++++++++++++++-----------------\n 1 file changed, 23 insertions(+), 27 deletions(-)", "diff": "diff --git a/src/gstreamer/gstlibcamerasrc.cpp b/src/gstreamer/gstlibcamerasrc.cpp\nindex 380f8368af8b..e0eb6e7b4227 100644\n--- a/src/gstreamer/gstlibcamerasrc.cpp\n+++ b/src/gstreamer/gstlibcamerasrc.cpp\n@@ -528,47 +528,43 @@ gst_libcamera_create_video_pool(GstLibcameraSrc *self,\n {\n \tg_autoptr(GstQuery) query = NULL;\n \tconst gboolean need_pool = true;\n-\tgboolean has_video_meta = false;\n \tGstBufferPool *video_pool = NULL;\n \n \tgst_libcamera_extrapolate_info(info, stream_cfg.stride);\n \n \tquery = gst_query_new_allocation(caps, need_pool);\n-\tif (!gst_pad_peer_query(srcpad, query))\n+\tif (!gst_pad_peer_query(srcpad, query)) {\n \t\tGST_DEBUG_OBJECT(self, \"Didn't get downstream ALLOCATION hints\");\n-\telse\n-\t\thas_video_meta = gst_query_find_allocation_meta(query, GST_VIDEO_META_API_TYPE, NULL);\n+\t\treturn { NULL, 0 };\n+\t}\n \n-\tif (!has_video_meta) {\n-\t\tGstBufferPool *pool = NULL;\n+\tif (gst_query_find_allocation_meta(query, GST_VIDEO_META_API_TYPE, NULL))\n+\t\treturn { NULL, 0 };\n \n-\t\tif (gst_query_get_n_allocation_pools(query) > 0)\n-\t\t\tgst_query_parse_nth_allocation_pool(query, 0, &pool, NULL, NULL, NULL);\n+\tif (gst_query_get_n_allocation_pools(query) > 0)\n+\t\tgst_query_parse_nth_allocation_pool(query, 0, &video_pool, NULL, NULL, NULL);\n \n-\t\tif (pool)\n-\t\t\tvideo_pool = pool;\n-\t\telse {\n-\t\t\tGstStructure *config;\n-\t\t\tguint min_buffers = 3;\n-\t\t\tvideo_pool = gst_video_buffer_pool_new();\n+\tif (!video_pool) {\n+\t\tGstStructure *config;\n+\t\tguint min_buffers = 3;\n \n-\t\t\tconfig = gst_buffer_pool_get_config(video_pool);\n-\t\t\tgst_buffer_pool_config_set_params(config, caps, info->size, min_buffers, 0);\n+\t\tvideo_pool = gst_video_buffer_pool_new();\n+\t\tconfig = gst_buffer_pool_get_config(video_pool);\n+\t\tgst_buffer_pool_config_set_params(config, caps, info->size, min_buffers, 0);\n \n-\t\t\tGST_DEBUG_OBJECT(self, \"Own pool config is %\" GST_PTR_FORMAT, config);\n+\t\tGST_DEBUG_OBJECT(self, \"Own pool config is %\" GST_PTR_FORMAT, config);\n \n-\t\t\tgst_buffer_pool_set_config(GST_BUFFER_POOL_CAST(video_pool), config);\n-\t\t}\n+\t\tgst_buffer_pool_set_config(GST_BUFFER_POOL_CAST(video_pool), config);\n+\t}\n \n-\t\tGST_WARNING_OBJECT(self, \"Downstream doesn't support video meta, need to copy frame.\");\n+\tGST_WARNING_OBJECT(self, \"Downstream doesn't support video meta, need to copy frame.\");\n \n-\t\tif (!gst_buffer_pool_set_active(video_pool, true)) {\n-\t\t\tgst_caps_unref(caps);\n-\t\t\tGST_ELEMENT_ERROR(self, RESOURCE, SETTINGS,\n-\t\t\t\t\t (\"Failed to active buffer pool\"),\n-\t\t\t\t\t (\"gst_libcamera_src_negotiate() failed.\"));\n-\t\t\treturn { NULL, -EINVAL };\n-\t\t}\n+\tif (!gst_buffer_pool_set_active(video_pool, true)) {\n+\t\tgst_caps_unref(caps);\n+\t\tGST_ELEMENT_ERROR(self, RESOURCE, SETTINGS,\n+\t\t\t\t (\"Failed to active buffer pool\"),\n+\t\t\t\t (\"gst_libcamera_src_negotiate() failed.\"));\n+\t\treturn { NULL, -EINVAL };\n \t}\n \n \treturn { video_pool, 0 };\n", "prefixes": [ "4/4" ] }