From patchwork Mon Mar 4 09:49:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Fang Hui X-Patchwork-Id: 19625 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 78AABC326B for ; Mon, 4 Mar 2024 10:21:47 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 99D076286F; Mon, 4 Mar 2024 11:21:46 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=nxp.com header.i=@nxp.com header.b="ahkk2P+f"; dkim-atps=neutral Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03on20601.outbound.protection.outlook.com [IPv6:2a01:111:f403:260d::601]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 0702961C8F for ; Mon, 4 Mar 2024 11:21:45 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GyWkCb8RgxbutpWQ8poahEgRwax4wLYnMVRCF2qfEB5xmK8s2chDPnsueDBh21thdawiRUUP3Xu0/DEVOnMPQGbLyK603iuPosF7Cp1/EkAvAki8RatdCRwW10FoF0Q/ww1LbNzWXts7SXidEZbDwCZXl6cy/FWaJ0QfeuFLG0285QGXNxvqsdDtsDeaVT36YEAJVcu7TcEoCJ0SR3xKqQspB5jClqi0RLG9d+7D2fDNaIF0J4EoorglxeiNoUbzYnwKoWUnw4tt7GAuYKA7C2xDfTf6wd4QZc3J7B8qg9T2l5ewzkK6zUb6cMyBKHEW3+78xmh6Xr6rqLp/L3flSQ== 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=iKxfIQ+8a38j9sWaq/2F3rnMjtE8oZJc4hBVhwYRhAw=; b=bE4W1DdDknGFmDjLkvlbV7JJ/HAPFSr8MPCxJ4sfUPjLtiiFDdFKvyIqJo71XiwlJ+TnxKXQXfLVpbRJLogDDWwlt5lj0kHtP0y/dmrsewIpGFWOPmFd254ORdqYFRxWALCCUrNvuELQIjFwkxKnrDj/GeX3ZSgq+oWGf+vB/pfifSSgFRy1ejdg28g1MDV36Hj+qcqvQJZad9TN1jbbzOl8ZR8+rQC+lvn5+MgVJqiUUtk7xrbpB7CDhS8tWtRHRYuWvwaxc96189e6Ig0vzhI0RhqJNYryjpZRsgeu5T5zQ+SFanezRXYV9VJzO02ED3/ZxRxAIdCxkS+RU02+ow== 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=iKxfIQ+8a38j9sWaq/2F3rnMjtE8oZJc4hBVhwYRhAw=; b=ahkk2P+fpvQpb8MtaYEdXaRT2EsXkrFJ6W2aE718ld7MTL2x9WQRzJev3DGDRF/1OA4MNNUbJs/4AkDPelJeGF7XxTAqG7APyxDhwRplOy+wM7XWEyOIokOGJi/NjyvEzK8I0uVjKMU13Jufik7IIafNX8TN4M71BmW5NzTyfww= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from DB9PR04MB9284.eurprd04.prod.outlook.com (2603:10a6:10:36c::8) by PAXPR04MB9090.eurprd04.prod.outlook.com (2603:10a6:102:227::17) 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 10:21:41 +0000 Received: from DB9PR04MB9284.eurprd04.prod.outlook.com ([fe80::f658:f649:f731:17cb]) by DB9PR04MB9284.eurprd04.prod.outlook.com ([fe80::f658:f649:f731:17cb%7]) with mapi id 15.20.7339.035; Mon, 4 Mar 2024 10:21:41 +0000 From: Fang Hui To: libcamera-devel@lists.libcamera.org Subject: [PATCH] android: camera_device: Fix camera blocked issue when stopping capture Date: Mon, 4 Mar 2024 17:49:17 +0800 Message-Id: <20240304094917.1144992-1-hui.fang@nxp.com> X-Mailer: git-send-email 2.25.1 X-ClientProxiedBy: SG2PR02CA0008.apcprd02.prod.outlook.com (2603:1096:3:17::20) To DB9PR04MB9284.eurprd04.prod.outlook.com (2603:10a6:10:36c::8) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB9PR04MB9284:EE_|PAXPR04MB9090:EE_ X-MS-Office365-Filtering-Correlation-Id: 9bef80d5-c68e-405e-97a9-08dc3c34e22b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: FjXgL8bfVHQbH6lsuSVly7egjDZwi1mvhT6hxBBlylOXfUhNMQNIfAqU70oIuGfxu6fuOfxVpZmby2Q5Kn9bWTxIHDDf811wrRY/WBD8p+hPJNZmhWUR04ZsCalKeh1YH3svIHcJutqMWhg/9eeLtyDLnCQMMXYAm+Z/xrBSW72k8cjNZ1ZRpaI1evldb40tlXOKjimroHijS2eJItNNN1J/MAKYX/Ipgp7kEnZuAfyCZ/VVLmQgmCRq28j1JZmrGg8jBTnku6o2A9+gs0iB1mQYP4xe3uwv6Xrv+bpnOFnBb9oo6suWQRF+Ifq+If7Rxnspy7/Gdnb3YLErHH+S5Nx81WrQVsPnr18W2WbrukmE40pduIdmh4nDblI7WgxJFPjzvk95VPI+/RB1bfsTrgqyDzRX4i+fJ2zYaN1LZuxpVwvp20lsR8HFgYPokD7pUz8/GJZovn0ApM91Auydtr2DX3QAQfVHMbYsff8xghRYyStjyeQylozk+o0UJLMzLwlHBuYoGvokHSTQ6b02CpX73v3DOJxyEaneRq8WC15C5DiFMNYPb+4DCn4PQKECJfScmYAHk2ntv/Xl6sk3JZVOGQokcq4M8Rqs4XPhSHfhssWdblIGBhEiR5UZec9pMxXghokByhSl4SAhUFSSO/QfwKpQ4uV8VuqBuzmrXidNWZcxbh1nNfId6V8F8fIa9cavt6xrn9En5Wq9SRz5fA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DB9PR04MB9284.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?1+Z77yvHMfd6MoLFpHL3F/oDu?= =?utf-8?q?iip+e1yqQODnUdBq01KYoo60WBe7FwH2uUttGg+z8yl7V+RmbylOzw1B?= =?utf-8?q?CXm0Dfei69nrVpfgvHgbTxkyMN1JqpwFLdxYs9fsK3Aq4Jc7fHiqTSZt?= =?utf-8?q?96WkjMATC5pJlhR0arKDL0a4wbARcFHcPmaGLWpWYUfqdK5Ghax2LJIs?= =?utf-8?q?nXzTb0gvwGdJbC9nnNB+YoUYGrlKzqbkIoP16gq/56DkeCinu2e8+WYY?= =?utf-8?q?hhrvT4+sif3lZGuTMlaSDYCcvONcH2VyQBWR9z+YzOWfiueX32rP57fN?= =?utf-8?q?3xkHR51o9By1cMS4oQNzwJniiHhDawOVLy2PZp6K9vsy+a3QcW/bsJEI?= =?utf-8?q?2eNmQf3/DB9tW8c1l01ywBxzXKNaPVfZiJZeQZ+tFh5iuSS1tFHpGfHI?= =?utf-8?q?YvQH1+AJOtd2lP4l1oCt1Ij24jCt9c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jPwJpyfBdJ9AbuzmPGHobr7H9vCvpy?= =?utf-8?q?FDWPLB2yyVcWLb2BKvHBGeSMXJqo1Ln+iGlZK/UwGDAP5nYvr4sofkDh?= =?utf-8?q?CPSgUGUw4GJEKdmaIDyH75kAvC0I1IP730e7FBWGNGB7TSx8EtF+toTD?= =?utf-8?q?u6pTBDg8kKJaj2NllX0CI5q6HnbRJ69dkEpiY6R3Q6eytgx0WGxS0DCc?= =?utf-8?q?aR9O1/mKRqNBXl52/lDTEwXWP+OYFMtaUGqVF+Fp+3lLOhSab71aGSey?= =?utf-8?q?YoigjFx?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9bef80d5-c68e-405e-97a9-08dc3c34e22b X-MS-Exchange-CrossTenant-AuthSource: DB9PR04MB9284.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Mar 2024 10:21:41.4195 (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: zuHUKdCMeVffESlzWyp34/zqvp4RrGu7dGCehIJbfPJi4i2PPsNrhiMmTpsem4DRKpr4Suo+tY7UQ3+O1ozZGQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB9090 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: anle.pan@nxp.com Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" From: Anle Pan 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 --- 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();