[v2,20/32] libcamera: v4l2_videodevice: Do not hide frame drops
diff mbox series

Message ID 20260325151416.2114564-21-stefan.klug@ideasonboard.com
State New
Headers show
Series
  • rkisp1: pipeline rework for PFC
Related show

Commit Message

Stefan Klug March 25, 2026, 3:13 p.m. UTC
From: Jacopo Mondi <jacopo.mondi@ideasonboard.com>

Autocorrecting the sequence number in case it doesn't start with 0
produces difficult to debug problems in cases where the first frame got
lost. We need to handle these properly in the pipeline handler (and fix
kernel drivers if needed).

Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>

---

Changes in v2:
- Rewrote commit message.
---
 include/libcamera/internal/v4l2_videodevice.h |  1 -
 src/libcamera/v4l2_videodevice.cpp            | 15 ---------------
 2 files changed, 16 deletions(-)

Patch
diff mbox series

diff --git a/include/libcamera/internal/v4l2_videodevice.h b/include/libcamera/internal/v4l2_videodevice.h
index 57db0036db6b..de91fbd0f8dc 100644
--- a/include/libcamera/internal/v4l2_videodevice.h
+++ b/include/libcamera/internal/v4l2_videodevice.h
@@ -286,7 +286,6 @@  private:
 	EventNotifier *fdBufferNotifier_;
 
 	State state_;
-	std::optional<unsigned int> firstFrame_;
 
 	Timer watchdog_;
 	utils::Duration watchdogDuration_;
diff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp
index d877df29ee6e..2c911a11dba7 100644
--- a/src/libcamera/v4l2_videodevice.cpp
+++ b/src/libcamera/v4l2_videodevice.cpp
@@ -1904,19 +1904,6 @@  FrameBuffer *V4L2VideoDevice::dequeueBuffer()
 	if (V4L2_TYPE_IS_OUTPUT(buf.type))
 		return buffer;
 
-	/*
-	 * Detect kernel drivers which do not reset the sequence number to zero
-	 * on stream start.
-	 */
-	if (!firstFrame_.has_value()) {
-		if (buf.sequence)
-			LOG(V4L2, Info)
-				<< "Zero sequence expected for first frame (got "
-				<< buf.sequence << ")";
-		firstFrame_ = buf.sequence;
-	}
-	metadata.sequence -= firstFrame_.value();
-
 	Span<const FrameBuffer::Plane> framebufferPlanes = buffer->planes();
 	unsigned int numV4l2Planes = multiPlanar ? buf.length : 1;
 
@@ -1993,8 +1980,6 @@  int V4L2VideoDevice::streamOn()
 {
 	int ret;
 
-	firstFrame_.reset();
-
 	ret = ioctl(VIDIOC_STREAMON, &bufferType_);
 	if (ret < 0) {
 		LOG(V4L2, Error)