From bfb1506381ab702a05fc5037797f76f26cda1d83 Mon Sep 17 00:00:00 2001 From: Nicolas Dufresne Date: Wed, 20 May 2020 17:30:59 -0400 Subject: [PATCH] v4l2src: Ignore non-increasing sequence number With older kernel, older driver or just broken drivers, the sequence number may not be increasing. This simply ignore the sequence in this case. This would otherwise miss-leading large amount of lost frame being reported. Fixes #729 Part-of: --- sys/v4l2/gstv4l2src.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sys/v4l2/gstv4l2src.c b/sys/v4l2/gstv4l2src.c index 5ebac9efcf..c5237011a5 100644 --- a/sys/v4l2/gstv4l2src.c +++ b/sys/v4l2/gstv4l2src.c @@ -978,7 +978,9 @@ retry: /* use generated offset values only if there are not already valid ones * set by the v4l2 device */ if (!GST_BUFFER_OFFSET_IS_VALID (*buf) - || !GST_BUFFER_OFFSET_END_IS_VALID (*buf)) { + || !GST_BUFFER_OFFSET_END_IS_VALID (*buf) + || GST_BUFFER_OFFSET (*buf) <= + (v4l2src->offset - v4l2src->renegotiation_adjust)) { GST_BUFFER_OFFSET (*buf) = v4l2src->offset; GST_BUFFER_OFFSET_END (*buf) = v4l2src->offset + 1; if (!half_frame || !v4l2src->next_offset_same)