[libcamera-devel] [PATCH 1/6] qcam: Tie FrameBufferAllocator to stream life
Laurent Pinchart
laurent.pinchart at ideasonboard.com
Thu Feb 6 23:04:38 CET 2020
Hi Kieran,
Thank you for the patch.
On Thu, Feb 06, 2020 at 03:04:59PM +0000, Kieran Bingham wrote:
> 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 <kieran.bingham at ideasonboard.com>
> ---
> 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();
> }
You can remove the braces.
Reviewed-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
>
> @@ -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();
--
Regards,
Laurent Pinchart
More information about the libcamera-devel
mailing list