From patchwork Thu Feb 6 15:04:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 2787 Return-Path: Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 47CBB600FB for ; Thu, 6 Feb 2020 16:05:10 +0100 (CET) Received: from localhost.localdomain (cpc89242-aztw30-2-0-cust488.18-1.cable.virginm.net [86.31.129.233]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id C8978B7D; Thu, 6 Feb 2020 16:05:09 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1581001509; bh=UJkVQsVGvnWAUNkG0qoptPT5FM8CRgTpkacB4zCmKHw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=i6BJE5igwgb/Nt+nnItEBuQBRYSiVS23vfcZEZlY68rmcDUCa9Ut8QqF1y/3WRGNF vT8WiuZEB+lpzuakTRoXfzZXiY1ptx8RqMfGtqyNmGyDZrxndQ6kWAJZDBHRMMAsJi lUqPh1ehHqHRsbSC23r+BS47SQwNmpiNPswEdC44= From: Kieran Bingham To: LibCamera Devel Date: Thu, 6 Feb 2020 15:04:59 +0000 Message-Id: <20200206150504.24204-2-kieran.bingham@ideasonboard.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200206150504.24204-1-kieran.bingham@ideasonboard.com> References: <20200206150504.24204-1-kieran.bingham@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 1/6] qcam: Tie FrameBufferAllocator to stream life 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: , X-List-Received-Date: Thu, 06 Feb 2020 15:05:10 -0000 The FrameBufferAllocator must be deleted and reconstructed before performing any reconfiguration of the stream. Construct the allocator at startCapture, and destroy it during stopCapture so that we can successfully stop and restart the stream. Signed-off-by: Kieran Bingham Reviewed-by: Laurent Pinchart --- src/qcam/main_window.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/qcam/main_window.cpp b/src/qcam/main_window.cpp index df51fa888342..38bc04a23b86 100644 --- a/src/qcam/main_window.cpp +++ b/src/qcam/main_window.cpp @@ -37,7 +37,6 @@ MainWindow::MainWindow(CameraManager *cm, const OptionsParser::Options &options) ret = openCamera(cm); if (!ret) { - allocator_ = FrameBufferAllocator::create(camera_); ret = startCapture(); } @@ -50,7 +49,6 @@ MainWindow::~MainWindow() { if (camera_) { stopCapture(); - delete allocator_; camera_->release(); camera_.reset(); } @@ -171,6 +169,7 @@ int MainWindow::startCapture() adjustSize(); + allocator_ = FrameBufferAllocator::create(camera_); ret = allocator_->allocate(stream); if (ret < 0) { std::cerr << "Failed to allocate capture buffers" << std::endl; @@ -255,6 +254,8 @@ void MainWindow::stopCapture() } mappedBuffers_.clear(); + delete allocator_; + isCapturing_ = false; config_.reset();