From 4e79b2ef310c3a68e4e9af4ee9c5e99fc0c17109 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Fri, 12 Jul 2019 13:51:12 +0300 Subject: libcamera: v4l2_videodevice: Signal buffer completion at streamoff time MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When stopping the stream buffers have been queued, in which case their completion is never be notified to the user. This can lead to memory leaks. Fix it by notifying completion of all queued buffers with the status set to error. As a result the base PipelineHandler implementation can be simplified, as all requests complete as the result of stopping the stream. The stop() method that manually completes all queued requests isn't needed anymore. Signed-off-by: Laurent Pinchart Reviewed-by: Niklas Söderlund --- test/v4l2_videodevice/buffer_sharing.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'test/v4l2_videodevice') diff --git a/test/v4l2_videodevice/buffer_sharing.cpp b/test/v4l2_videodevice/buffer_sharing.cpp index da052f34..12ec88f2 100644 --- a/test/v4l2_videodevice/buffer_sharing.cpp +++ b/test/v4l2_videodevice/buffer_sharing.cpp @@ -95,6 +95,9 @@ protected: std::cout << "Received capture buffer: " << buffer->index() << " sequence " << buffer->sequence() << std::endl; + if (buffer->status() != Buffer::BufferSuccess) + return; + output_->queueBuffer(buffer); framesCaptured_++; } @@ -104,6 +107,9 @@ protected: std::cout << "Received output buffer: " << buffer->index() << " sequence " << buffer->sequence() << std::endl; + if (buffer->status() != Buffer::BufferSuccess) + return; + capture_->queueBuffer(buffer); framesOutput_++; } -- cgit v1.2.1