[libcamera-devel] [PATCH v2 02/11] qcam: main_window: Explicitly name raw buffer

Niklas Söderlund niklas.soderlund at ragnatech.se
Fri Oct 16 01:25:15 CEST 2020


Hi Kieran,

On 2020-10-15 23:39:09 +0100, Kieran Bingham wrote:
> On 15/10/2020 23:37, Kieran Bingham wrote:
> > The buffer obtained for queuing to a raw stream aliases the buffer
> > passed in for the main view finder stream.
> > 
> > Prevent aliasing, and explicitly name the buffer as a separate variable.
> > 
> > Suggested-by: Niklas Söderlund <niklas.soderlund at ragnatech.se>
> 
> Signed-off-by: Kieran Bingham <kieran.bingham at ideasonboard.com>

:-)

Reviewed-by: Niklas Söderlund <niklas.soderlund at ragnatech.se>

> 
> > ---
> >  src/qcam/main_window.cpp | 8 ++++----
> >  1 file changed, 4 insertions(+), 4 deletions(-)
> > 
> > diff --git a/src/qcam/main_window.cpp b/src/qcam/main_window.cpp
> > index 0cbdab9a6bce..f140313ede8d 100644
> > --- a/src/qcam/main_window.cpp
> > +++ b/src/qcam/main_window.cpp
> > @@ -769,16 +769,16 @@ void MainWindow::queueRequest(FrameBuffer *buffer)
> >  	request->addBuffer(vfStream_, buffer);
> >  
> >  	if (captureRaw_) {
> > -		FrameBuffer *buffer = nullptr;
> > +		FrameBuffer *rawBuffer = nullptr;
> >  
> >  		{
> >  			QMutexLocker locker(&mutex_);
> >  			if (!freeBuffers_[rawStream_].isEmpty())
> > -				buffer = freeBuffers_[rawStream_].dequeue();
> > +				rawBuffer = freeBuffers_[rawStream_].dequeue();
> >  		}
> >  
> > -		if (buffer) {
> > -			request->addBuffer(rawStream_, buffer);
> > +		if (rawBuffer) {
> > +			request->addBuffer(rawStream_, rawBuffer);
> >  			captureRaw_ = false;
> >  		} else {
> >  			qWarning() << "No free buffer available for RAW capture";
> > 
> 
> -- 
> Regards
> --
> Kieran

-- 
Regards,
Niklas Söderlund


More information about the libcamera-devel mailing list