From patchwork Tue Sep 22 09:47:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 9688 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 09AC3BF01C for ; Tue, 22 Sep 2020 09:44:19 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id DBCCD62FD4; Tue, 22 Sep 2020 11:44:18 +0200 (CEST) Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [217.70.183.196]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 399E160364 for ; Tue, 22 Sep 2020 11:44:18 +0200 (CEST) X-Originating-IP: 93.34.118.233 Received: from uno.lan (93-34-118-233.ip49.fastwebnet.it [93.34.118.233]) (Authenticated sender: jacopo@jmondi.org) by relay4-d.mail.gandi.net (Postfix) with ESMTPSA id 02AF6E000D; Tue, 22 Sep 2020 09:44:11 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Tue, 22 Sep 2020 11:47:34 +0200 Message-Id: <20200922094738.5327-5-jacopo@jmondi.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200922094738.5327-1-jacopo@jmondi.org> References: <20200922094738.5327-1-jacopo@jmondi.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 4/8] android: camera_device: Clear allocator at configureStream 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: hanlinchen@chromium.org Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" The configureStream operation might be called by the Android framework in two successive capture session without going through a close(). Clear all the allocated buffers before configuring the camera streams. Reviewed-by: Niklas Söderlund Reviewed-by: Hirokazu Honda Signed-off-by: Jacopo Mondi Reviewed-by: Kieran Bingham Reviewed-by: Laurent Pinchart --- src/android/camera_device.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp index 98b8159ebd8c..42fb9ea4e113 100644 --- a/src/android/camera_device.cpp +++ b/src/android/camera_device.cpp @@ -1182,12 +1182,13 @@ int CameraDevice::configureStreams(camera3_stream_configuration_t *stream_list) } /* - * Clear and remove any existing configuration from previous calls, and - * ensure the required entries are available without further - * reallocation. + * Clear and remove any existing configuration and memory allocated from + * previous calls, and ensure the required entries are available without + * further reallocation. */ streams_.clear(); streams_.reserve(stream_list->num_streams); + allocator_.clear(); /* First handle all non-MJPEG streams. */ camera3_stream_t *jpegStream = nullptr;