libcamera: v4l2_videodevice: Improve readability

The handling for the sequence number validation within
V4L2VideoDevice::dequeueBuffer makes use of a std::optional, which can
be used as a boolean in conditional statements. This has the impact in
this use case that it can be mis-read to be interpretting the value for
firstFrame_ which is assigned as the buf.sequence.

Remove this potential for confusion by making it clear that the first
frame handling is only performed when firstFrame_ does not have a value
assigned.

Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
[Kieran: Rework commit message]
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
Stefan Klug 2024-08-08 18:30:41 +01:00 committed by Kieran Bingham
parent 75fc944738
commit 33a49ce4a2

View file

@ -1840,7 +1840,7 @@ FrameBuffer *V4L2VideoDevice::dequeueBuffer()
* Detect kernel drivers which do not reset the sequence number to zero * Detect kernel drivers which do not reset the sequence number to zero
* on stream start. * on stream start.
*/ */
if (!firstFrame_) { if (!firstFrame_.has_value()) {
if (buf.sequence) if (buf.sequence)
LOG(V4L2, Info) LOG(V4L2, Info)
<< "Zero sequence expected for first frame (got " << "Zero sequence expected for first frame (got "