From patchwork Mon Mar 4 09:35:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Anle Pan X-Patchwork-Id: 19624 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 12838BD160 for ; Mon, 4 Mar 2024 10:00:27 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 208686286F; Mon, 4 Mar 2024 11:00:26 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=nxp.com header.i=@nxp.com header.b="Td/e7+ZB"; dkim-atps=neutral Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-db3eur04on0626.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe0c::626]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 3D8766286D for ; Mon, 4 Mar 2024 10:35:51 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iyGFN6ttPB7ixAjgHfbWuSdauNt0ePLTPIPHTMAUmiCBWcMTzXk4oTsVbBMhM15XPninrm77CxIFUrqkdc8LZ/7bJ9MCRtBOlTU4WurnLRJ7ODZ+ZO/PkUHna7zG3VRTRifXh7Koej+UxR/URivOTRwK3S19YhwA1QQXwoCgqiQGj8VKgxM8p1Ha1U7H/qTL60rZldDa4sIZOLR6sav+NiaT4LrJ6n0G8YB1S7xfaVz2WvawMeQOWigIqJavynLewxlhshFtuWat3hhtrvN/3XqPtm0XAwh2k7d047CY8p5+HUDBCipfzETwC8bp+tMmjFUoUFtljdT9ZTCPqLK/uA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=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; bh=OaRMnohJIb7BsL467IdV4r5zOF6lURkBROkLlS/RwsE=; b=BCOL3vSItrLOO70PCWNpY86Nd2bIY2sHi0UCp2Mf8r7OsjAlX20VwadF+Kqe6nR/JXy2dU5DpqBTmohNLN5CJ73VZt2VXJTY9mKyolhXwan2tc4Jii5/7AlVwjeJ1B7nDBGYN/soZvtrUa1yHRbiSL0LhtWEkgH8i+GUKV/kQQm11ane/MG9QCOr6PZGbmTmSjFr6Dx8tKxTF0a1+5r6zV/ZWukpQudE0UB3TN32ExfUFKyAVnX11236W8OMcW3CM/4/fxSPXANIp4GzvVHFDEgAal1dN5s8tmQkbSDrQfFAR/1n88PxyrrfTPFMJjMgk1BjJuDoW9gLGmLozzmHdQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=OaRMnohJIb7BsL467IdV4r5zOF6lURkBROkLlS/RwsE=; b=Td/e7+ZBBo8Wmg2MQ4OrfhAvNMA752j8HcS53MOF9sbkp+yFazRSW56Sm1Mp76TQ1fXVvkbtSabrn6xl91MsSw8e9yNYt4kJ6L8Kj8Y48weYHrpnYSb1upSkeud+fMy0xnCGdGvCGYxFvOV75eKaIXxycmyqpeSrqWMUEKenzz4= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from DU2PR04MB8967.eurprd04.prod.outlook.com (2603:10a6:10:2e2::19) by DB9PR04MB8494.eurprd04.prod.outlook.com (2603:10a6:10:2c6::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7339.38; Mon, 4 Mar 2024 09:35:49 +0000 Received: from DU2PR04MB8967.eurprd04.prod.outlook.com ([fe80::863b:1be2:4278:3470]) by DU2PR04MB8967.eurprd04.prod.outlook.com ([fe80::863b:1be2:4278:3470%4]) with mapi id 15.20.7339.035; Mon, 4 Mar 2024 09:35:49 +0000 From: Anle Pan To: libcamera-devel@lists.libcamera.org Subject: [PATCH] android: camera_device: Fix camera blocked issue when stopping capture Date: Mon, 4 Mar 2024 10:35:39 +0100 Message-Id: <20240304093539.546973-1-anle.pan@nxp.com> X-Mailer: git-send-email 2.34.1 X-ClientProxiedBy: AM0PR02CA0148.eurprd02.prod.outlook.com (2603:10a6:20b:28d::15) To DU2PR04MB8967.eurprd04.prod.outlook.com (2603:10a6:10:2e2::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU2PR04MB8967:EE_|DB9PR04MB8494:EE_ X-MS-Office365-Filtering-Correlation-Id: a748fb5b-63ad-4a8d-64f7-08dc3c2e7a34 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: TzY5wXqNLzcVt8tX/Pm9fiI+4GGndZIkOcV+xGKGXBkeUxJpeqLQHU0byhg+xMvxpqNYrEDc0E6H/IO7+paLd1vyHkP0nDMG8Xgj1dBqjq6htLYxGMyWDFAEXDglY8EsY5HkA6s/Cnc/HfOgoeNr8QthlBJdo+FcBVxXH2JtqhMlKK03EvMMD6upNGnD6zeGHPD5CkdrR+A4QdkPEwRjUlxxAQqZ+6q+CKU8VFhYozcWzQf1bQgPucuQAkZoPwFJIHm0ZWUtS33RlY8BuOBgGdzyirTot5MX/2bj5p+no4hoh8PYWaJI6MlEcfbi0Smw3CJE0ZJzaiM/o0twSfHiVeQk8Ml2qtyirhvJ5bHoMtl10TCwI6F3iq4LZXAefIvR2rep14vs0RP/A+Z4PRoKGyk5W5rLu4xo2HUgu99VTzxDRY7Mzx2X8Khf5ge6ZIziZA9cQIqGN+PSdLS2oQgcexzQkTfilZqjCdryK6PXbEAXX8sapW+8b7W34tTp3UDF1ZjOsbF3kcCyoWiGANJYhUeyK9ddtntqWfRVKN39DzQGS6gOHw0q3esvbauN3DPg9XTQDsM4rDPwUgS0mYibuX8pI3oe+3aOaNUSTNsRqSuCg2skc56zrAcYc2sTxatlDiC26n4/zhU9P1cwSpcaJgmP2SwYfRag0wJLkoDEXqfs4rnwlN4OSiRml4zmUdtBOqy3/lD6rebsOvjLCWNaVQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DU2PR04MB8967.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(376005)(38350700005); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?w+wIzhi4KFEVBaYPRdQ7ZaOyr?= =?utf-8?q?Vbm3xnham9xPNHaCvlrCahnZ7cu1BKDsnJDh412w9Nrcfda5Hk1Q7jSJ?= =?utf-8?q?dcND5mfcwvqg82FEeEc++GnRn4AQjhWQ8BGrgjIbRZ7YrCkO84wPFxqX?= =?utf-8?q?R/Xi6W4IapKLFYCOwGBRxEQyIkLk6BbcJkTd56tuC0rHGptCsbJ2FEmx?= =?utf-8?q?FktxpAiZtBOBtAkotzVHIFxgg9Z1AzxPKjwxpXr4+jvBlZQBoVClH29r?= =?utf-8?q?0L6qwGiTNrk57A16WmBms3NjSNO020ZguzBlTCKycXao2xuHmeyMLKHA?= =?utf-8?q?Q49OjnBZdQ3iPq67XXgoRplHRCxPPN4WykPHfdIbqL9pT3m+U4xehHrr?= =?utf-8?q?1JcBLo6xSLUO9zxp9wrVyc6T+eJ4Nu6TUd3T+wRY9dLzZGlnGUUH0Unt?= =?utf-8?q?m6XXEk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BOYJ22mI7nO5SgrkSDWBpQI5nwVyzWb4EoT4BOoNiK77HJ+6D24?= =?utf-8?q?HXZ7YXPfJtiksTiQvtcBLRPbQUY1Jb+t0zHRRMkBrDZcHYlePohsWN4C?= =?utf-8?q?7LOTlpEcqT2I0WSwK6/hEIsL9jRnQBi3JmdGi/CDSvxJYanWcBkkil59?= =?utf-8?q?VvJ0yDBYIGD2FLOgaF+1O9KPVl0MAvTX/51Q2Bz+F0p7nb356nYfIH65?= =?utf-8?q?NsFY2JkuoQpqX4y5whS3ugNVxr0Dec+HLLSTSW4YxJQTwRERF0LXFcNY?= =?utf-8?q?0m9eFYk?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: a748fb5b-63ad-4a8d-64f7-08dc3c2e7a34 X-MS-Exchange-CrossTenant-AuthSource: DU2PR04MB8967.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Mar 2024 09:35:49.8312 (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: AX2E63XP7cjtbLI6nDhVpGKgvl5mmGrDOgzYJ5GNQ4+DSKGHnQis1GxwSUEcDe/8R6RUnV7dVxSw+DsaPimxJQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR04MB8494 X-Mailman-Approved-At: Mon, 04 Mar 2024 11:00:24 +0100 X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: hui.fang@nxp.com Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" The issue occurs when stopping capture soon after starting capture. In this case, no frame get from the device, the related capture request has been pushed to the queue descriptors_, but the queuedRequests_ was still empty due to no requests will be queue to the device since the stream will be stopped soon, so there will be no camera->requestComplete called later, then the descriptors_ can not pop normally, this will cause the pending if we want to start capture next time. To fix the issue, ensure the descriptors_ is empty after the camera device is stopped. Signed-off-by: Anle Pan Reviewed-by: Jacopo Mondi Tested-by: Jacopo Mondi Reviewed-by: Jacopo Mondi Tested-by: Jacopo Mondi Signed-off-by: Fang Hui --- src/android/camera_device.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp index 25cedd44..d452992d 100644 --- a/src/android/camera_device.cpp +++ b/src/android/camera_device.cpp @@ -433,8 +433,11 @@ void CameraDevice::flush() void CameraDevice::stop() { MutexLocker stateLock(stateMutex_); - if (state_ == State::Stopped) + if (state_ == State::Stopped) { + MutexLocker descriptorsLock(descriptorsMutex_); + descriptors_ = {}; return; + } camera_->stop();