libcamera: v4l2_videodevice: Signal buffer completion at streamoff time

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 <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
This commit is contained in:
Laurent Pinchart 2019-07-12 13:51:12 +03:00
parent a2bcf6feee
commit 4e79b2ef31
10 changed files with 34 additions and 40 deletions

View file

@ -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_++;
}