Patch Detail
Show a patch.
GET /api/patches/27434/?format=api
{ "id": 27434, "url": "https://patchwork.libcamera.org/api/patches/27434/?format=api", "web_url": "https://patchwork.libcamera.org/patch/27434/", "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": "<20260722034011.1016641-1-elliot.chen@oss.nxp.com>", "date": "2026-07-22T03:40:11", "name": "[v2] gstreamer: Honor downstream format preferences in caps negotiation", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "3f83f65175169954a86a29c315b72f473ccc5054", "submitter": { "id": 443, "url": "https://patchwork.libcamera.org/api/people/443/?format=api", "name": "Elliot Chen (OSS)", "email": "elliot.chen@oss.nxp.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/27434/mbox/", "series": [ { "id": 6071, "url": "https://patchwork.libcamera.org/api/series/6071/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=6071", "date": "2026-07-22T03:40:11", "name": "[v2] gstreamer: Honor downstream format preferences in caps negotiation", "version": 2, "mbox": "https://patchwork.libcamera.org/series/6071/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/27434/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/27434/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 6D2D1BDE17\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 22 Jul 2026 03:40:25 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 8707A67E7C;\n\tWed, 22 Jul 2026 05:40:24 +0200 (CEST)", "from AM0PR83CU005.outbound.protection.outlook.com\n\t(mail-westeuropeazlp170100001.outbound.protection.outlook.com\n\t[IPv6:2a01:111:f403:c201::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 73B7267E44\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 22 Jul 2026 05:40:22 +0200 (CEST)", "from AM9PR04MB8244.eurprd04.prod.outlook.com\n\t(2603:10a6:20b:3e0::24)\n\tby VI1PR04MB7184.eurprd04.prod.outlook.com (2603:10a6:800:125::15)\n\twith Microsoft SMTP Server (version=TLS1_2,\n\tcipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.245.10;\n\tWed, 22 Jul 2026 03:40:20 +0000", "from AM9PR04MB8244.eurprd04.prod.outlook.com\n\t([fe80::a59f:4bc2:f026:4012]) by\n\tAM9PR04MB8244.eurprd04.prod.outlook.com\n\t([fe80::a59f:4bc2:f026:4012%4]) with mapi id 15.21.0245.009;\n\tWed, 22 Jul 2026 03:40:20 +0000" ], "Authentication-Results": [ "lancelot.ideasonboard.com; dkim=pass (2048-bit key;\n\tunprotected) header.d=NXP1.onmicrosoft.com\n\theader.i=@NXP1.onmicrosoft.com header.b=\"s82WtrV1\"; \n\tdkim-atps=neutral", "dkim=none (message not signed)\n\theader.d=none;dmarc=none action=none header.from=oss.nxp.com;" ], "ARC-Seal": "i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none;\n\tb=mUPcLHbOdf1qt1olob5HFzAnpXq8n9m4S6U3zkxXHmevaFBfhyphOoP76HD5L6Y91IazQiqxEph+XbSda2WlwBBjxPbGzGToPzqd8UBMsBlQg/Sp0Rj0mV83bX0wmAqX20PGnbmRx6uEe1YpKwgLv6ZTVO49TPcAPxViI3Yof0V6PPcBBXDFpBzUlq7HQVrjTppwMmQMjIe2VfZFeRuO9HbqkqtwShuXKPHh1LJIvr2TUPAP/O/xQilgGVRz4t/kfTTATH5HiEaWhTnqgNZPb3y1dbJA2x5ESmBY3XordQfiq/pNzNFbSBpj91aCGFIr46dMqFYeyKF4Ip//nWQgfw==", "ARC-Message-Signature": "i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;\n\ts=arcselector10001;\n\th=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;\n\tbh=06JQmtQkDRqhj2JFDZPpQP8q9A8Hdq+3TSRnQGrnxTA=;\n\tb=v5SQdJt62raTPrxB97minTmCjqG5MXKtjuO1fsf5YlZQQIu7aqH6Zr8B2c4OhnmButA0ANfyelFlZJxVQbS3I9TqTddolWxM7YCcLrOuF5+5juM60nGuppvqmWaendZTq0eqxOn2BtJjmx9nuKMa2O/u8w7LkTRAedqSYPXpv7RWEq+uEvTbyME3oQXbiGbfSVFriHuMDao8MReNtM15hBU6YxBaeYMx/hxKeMR2zEMuvh0d8rMXqnx2YrriREm8oKvojjncrtwix/F4ZvDXmD53wU2MK5oFFTpisC1WlbW5pkP0E5Fb5dJDPloT7jNBNT4I6jXlF6nRbzJbMP1hQA==", "ARC-Authentication-Results": "i=1; mx.microsoft.com 1; spf=pass\n\tsmtp.mailfrom=oss.nxp.com;\n\tdmarc=pass action=none header.from=oss.nxp.com; \n\tdkim=pass header.d=oss.nxp.com; arc=none", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com;\n\ts=selector1-NXP1-onmicrosoft-com;\n\th=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;\n\tbh=06JQmtQkDRqhj2JFDZPpQP8q9A8Hdq+3TSRnQGrnxTA=;\n\tb=s82WtrV1p1MkTPJ2H21OWX4zODOl4mZMej2baojU0li75RyQ6r0junFM1Lxxe/u+sCeCXx5cFFmMXEgebM7duhZy29gFv3dpRmifw1sHKF/HNwmJ0cUgsqfwIp58X0PGjS374E06mtVA7CeWtDLlE2rl60/aMPcPaRdODJQ7HxraV0CAk0Uu7rZ9J9AXyMSLbW6rW2AN6xHVTq4QWtutFZQ2qYwFyLXjIjUHZJSGf52/IUMrTkdiI8Se+mxboLPfr3b0UrEpP+XFofuvx1zynvAamxJxNgaRODhSwi5IWTN97AonK4ZF399KJYoK8FpSvY94GrOJrQQaCMVWT7VEnA==", "From": "elliot.chen@oss.nxp.com", "To": "libcamera-devel@lists.libcamera.org,\n\telliot.chen@nxp.com", "Subject": "[PATCH v2] gstreamer: Honor downstream format preferences in caps\n\tnegotiation", "Date": "Wed, 22 Jul 2026 12:40:11 +0900", "Message-Id": "<20260722034011.1016641-1-elliot.chen@oss.nxp.com>", "X-Mailer": "git-send-email 2.34.1", "Content-Transfer-Encoding": "8bit", "Content-Type": "text/plain", "X-ClientProxiedBy": "MA5PR01CA0026.INDPRD01.PROD.OUTLOOK.COM\n\t(2603:1096:a01:178::7) To AM9PR04MB8244.eurprd04.prod.outlook.com\n\t(2603:10a6:20b:3e0::24)", "MIME-Version": "1.0", "X-MS-PublicTrafficType": "Email", "X-MS-TrafficTypeDiagnostic": "AM9PR04MB8244:EE_|VI1PR04MB7184:EE_", "X-MS-Office365-Filtering-Correlation-Id": "ae7edd6b-3b33-46a9-cdb3-08dee7a2f470", "X-MS-Exchange-SenderADCheck": "1", "X-MS-Exchange-AntiSpam-Relay": "0", "X-Microsoft-Antispam": "BCL:0;\n\tARA:13230040|376014|19092799006|366016|23010399003|1800799024|5023799004|56012099006|11063799006|10067099003|6133799003|18002099003|3023799007;", "X-Microsoft-Antispam-Message-Info": "N2JP0h+3PI+UnyaQG5MYCra1BBwnjoIe74KBx23sQAhPp7cM+MDt5iQtxgRLgRb3S5wUtZiLxPFpWSZfCC6tnMZ6EfpFoY+K0YCpwl7IM5tmGzxyTga7lVHC2xIFRaxMc0dYPOTijcVLgoKBvB/uqck3eiWc8v6RsyMjS/SJloALbTRo8g+0ttImIcCeJSYa24Hh0Ezriu7wLD+l20Omhkfo+qWygcAJYw9q6btYajewOmiZJTwZlWX2+Fia+vRrka+ebnzk7O92jg2b+lQyyiSnSFSCu8CZIdr0v72AnNyUrNV6bRO2sOygSETT4+SmVYAYo/kKgjn8KxyZJKAF9IsEXPwYDeSaRZ74w5s+EmDIX/OHzVTJW5QtL3s1GPGliqrNKYuqt65PQPhjW++PW7TctL0Cu6gjaTgKGIlRBLVminB5+b4Csu6f70RLFJhDlRKDITwxTIzbU1QH+ixi3v5pBFz0nOGCjgD9khklql/mkNGMXeKFgTp9xdvurxf8V4J/ZLGWQk2dZgKydN6CBAkFaoYomEeRQwTeViCGpA1CFWQVPEiF3PEsMmk6UBBm2HYV55PtHJ4kijytqdU0XBGtuuBYF0V9ZqxkrnzivfsiPlr3d5kw1P09wvVuO3Tzma5Yw/V0T13wTT0jSdSC3dpYzjbTyAxV6x5OlvgrFyE=", "X-Forefront-Antispam-Report": "CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:;\n\tIPV:NLI; SFV:NSPM; H:AM9PR04MB8244.eurprd04.prod.outlook.com; PTR:;\n\tCAT:NONE; \n\tSFS:(13230040)(376014)(19092799006)(366016)(23010399003)(1800799024)(5023799004)(56012099006)(11063799006)(10067099003)(6133799003)(18002099003)(3023799007);\n\tDIR:OUT; SFP:1101; ", "X-MS-Exchange-AntiSpam-MessageData-ChunkCount": "1", "X-MS-Exchange-AntiSpam-MessageData-0": "n7gn0VKfHr6R/d2NKgL93N/Rm2cICjFiENw0OWdDhx7qZI6ip+PDQBsGsQJ5cqt3UsMgWEwpQLGw7Sd8L1dT4BpsurjcFjQfeufKGnwnbEPy+dOoQyjMLaaCHeVS36rHPheIn/70PKMrMnpHmziJo76yFpsQxpxApVgeDVpBrRBs/s2ZveT4ZEvTzXQKtHP+UVc22Mcct8OPid4STwScFWECPBA2K1ibdWzl3idskTB6mC1Y99kknt87iaFXLbBx7Oqo3yRuiPpSc+pO64cKP+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c+cvrWyqJkkOq8x7Ny0+4Nm1DeEHAm1L0nHYvA2XwCoSERg8vs0lDvflhl2BvNgBFd5/tF6cP7M0Cn9HV5k9d2XrfLb5/n5faI2exJj+E8O5K9i+eLTT5a4ecgkR+aF6nr7Ym/6SUXVk+MfJVDxytbIP7y4xMoV2LoEp6TzAcApS/0Tlo1FL/Q8QxpPEBff4J3iYJBDCGwGKb2hvgE82MKgoypNyUrgatTWoSkF/A8Kh5Ys9Q+eTxU6c3DwgrxxN4Z607PMB02cmplxQCTzQ1/5Nx+8dpmmCSoYnsarDPtjHSdqZgU66p0lLKyP28DO3f/9WljV+v1Hj3XjhoM7AblMaICZ+9+uKhlD+7YwHzlUIGU0qadisWzyqOuZMQJs+SATmm3lWzYpP9dvvZTLhnk1Sk8kIGWPe5EqBo74lnOY2Wu01FNgsl0rThxlF8ea+", "X-OriginatorOrg": "oss.nxp.com", "X-MS-Exchange-CrossTenant-Network-Message-Id": "ae7edd6b-3b33-46a9-cdb3-08dee7a2f470", "X-MS-Exchange-CrossTenant-AuthSource": "AM9PR04MB8244.eurprd04.prod.outlook.com", "X-MS-Exchange-CrossTenant-AuthAs": "Internal", "X-MS-Exchange-CrossTenant-OriginalArrivalTime": "22 Jul 2026 03:40:20.7269\n\t(UTC)", "X-MS-Exchange-CrossTenant-FromEntityHeader": "Hosted", "X-MS-Exchange-CrossTenant-Id": "686ea1d3-bc2b-4c6f-a92c-d99c5c301635", "X-MS-Exchange-CrossTenant-MailboxType": "HOSTED", "X-MS-Exchange-CrossTenant-UserPrincipalName": "+NPFTNrnnrAZYkmvxPn3fBIj89BlygHSSSPUsy6UEMdwdPOkyYzyHmcWk0zgc/yoE4ufUZDYHm2BzqGZzGcHEUKiSD7Aiuu4MsX/oZHrW/gis382RCe5ZZGxblitkbQD", "X-MS-Exchange-Transport-CrossTenantHeadersStamped": "VI1PR04MB7184", "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": "From: Elliot Chen <elliot.chen@nxp.com>\n\nWhen using libcamerasrc as a camera source in camerabin with a\nvideo-source-filter that specifies a particular output format,\nthe negotiated format was not respecting the downstream preference.\nThis occurred because gst_pad_peer_query_caps() was called with the\nlibcamera stream format filter directly as its filter argument, which\ncaused the returned caps to be ordered by the libcamera source format\nlist rather than by the downstream element's preference.\n\nFix this by splitting the caps query into two steps: first query the\nfull set of caps supported by the downstream peer without any filter,\nthen intersect with the libcamera stream formats using\nGST_CAPS_INTERSECT_FIRST. This intersection mode preserves the order\nof the first operand (the downstream peer caps), so when the caps are\nsubsequently fixated, the format preferred by the downstream element\n(e.g. the video-source-filter in camerabin) is selected.\n\nSigned-off-by: Elliot Chen <elliot.chen@nxp.com>\n---\n src/gstreamer/gstlibcamerasrc.cpp | 7 ++++++-\n 1 file changed, 6 insertions(+), 1 deletion(-)", "diff": "diff --git a/src/gstreamer/gstlibcamerasrc.cpp b/src/gstreamer/gstlibcamerasrc.cpp\nindex 9061f9163..579bd466d 100644\n--- a/src/gstreamer/gstlibcamerasrc.cpp\n+++ b/src/gstreamer/gstlibcamerasrc.cpp\n@@ -598,8 +598,13 @@ gst_libcamera_src_negotiate(GstLibcameraSrc *self)\n \t\tStreamConfiguration &stream_cfg = state->config_->at(i);\n \n \t\t/* Retrieve the supported caps. */\n+\t\tg_autoptr(GstCaps) peer_caps = gst_pad_peer_query_caps(srcpad, NULL);\n+\t\tif (!peer_caps || gst_caps_is_empty(peer_caps))\n+\t\t\treturn false;\n+\n \t\tg_autoptr(GstCaps) filter = gst_libcamera_stream_formats_to_caps(stream_cfg.formats());\n-\t\tg_autoptr(GstCaps) caps = gst_pad_peer_query_caps(srcpad, filter);\n+\t\t/* Intersect with downstream's preferred format order first. */\n+\t\tg_autoptr(GstCaps) caps = gst_caps_intersect_full(peer_caps, filter, GST_CAPS_INTERSECT_FIRST);\n \t\tif (gst_caps_is_empty(caps))\n \t\t\treturn false;\n \n", "prefixes": [ "v2" ] }