[v3,10/41] libcamera: v4l2_videodevice: Do not hide frame drops
diff mbox series

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

Commit Message

Stefan Klug Sept. 14, 2026, 2:02 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 f63d74879ff2..cc962bf81187 100644
--- a/include/libcamera/internal/v4l2_videodevice.h
+++ b/include/libcamera/internal/v4l2_videodevice.h
@@ -286,7 +286,6 @@  private:
 	std::unique_ptr<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 41dc5d0f65ed..807107f99a03 100644
--- a/src/libcamera/v4l2_videodevice.cpp
+++ b/src/libcamera/v4l2_videodevice.cpp
@@ -1902,19 +1902,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();
-
 	std::span<const FrameBuffer::Plane> framebufferPlanes = buffer->planes();
 	unsigned int numV4l2Planes = multiPlanar ? buf.length : 1;
 
@@ -1991,8 +1978,6 @@  int V4L2VideoDevice::streamOn()
 {
 	int ret;
 
-	firstFrame_.reset();
-
 	ret = ioctl(VIDIOC_STREAMON, &bufferType_);
 	if (ret < 0) {
 		LOG(V4L2, Error)