aboutsummaryrefslogtreecommitdiffstats
path: root/utils/v4l2-ctl/v4l2-ctl-streaming.cpp
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil-cisco@xs4all.nl>2019-03-29 11:03:23 +0100
committerHans Verkuil <hverkuil-cisco@xs4all.nl>2019-03-29 16:05:20 +0100
commitd077345dc991a8359f4e3dcbfba214e5b36a2001 (patch)
treec5a269356d232179b1e23b3cd3189451cffea8f4 /utils/v4l2-ctl/v4l2-ctl-streaming.cpp
parent708fcea9090314f9a74543749238285f0536ffca (diff)
v4l2-ctl: ignore empty and error frames w.r.t. --stream-count
Empty frames and error frames should not decrement the counter set by --stream-count. Only count valid non-empty frames. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Diffstat (limited to 'utils/v4l2-ctl/v4l2-ctl-streaming.cpp')
-rw-r--r--utils/v4l2-ctl/v4l2-ctl-streaming.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/utils/v4l2-ctl/v4l2-ctl-streaming.cpp b/utils/v4l2-ctl/v4l2-ctl-streaming.cpp
index f882a799..8e9f7778 100644
--- a/utils/v4l2-ctl/v4l2-ctl-streaming.cpp
+++ b/utils/v4l2-ctl/v4l2-ctl-streaming.cpp
@@ -1391,11 +1391,14 @@ static int do_handle_cap(cv4l_fd &fd, cv4l_queue &q, FILE *fout, int *index,
return -1;
}
+ bool is_empty_frame = !buf.g_bytesused(0);
+ bool is_error_frame = buf.g_flags() & V4L2_BUF_FLAG_ERROR;
+
double ts_secs = buf.g_timestamp().tv_sec + buf.g_timestamp().tv_usec / 1000000.0;
fps_ts.add_ts(ts_secs, buf.g_sequence(), buf.g_field());
if (fout && (!stream_skip || ignore_count_skip) &&
- buf.g_bytesused(0) && !(buf.g_flags() & V4L2_BUF_FLAG_ERROR))
+ !is_empty_frame && !is_error_frame)
write_buffer_to_file(fd, q, buf, fmt, fout);
if (buf.g_flags() & V4L2_BUF_FLAG_KEYFRAME)
@@ -1445,6 +1448,9 @@ static int do_handle_cap(cv4l_fd &fd, cv4l_queue &q, FILE *fout, int *index,
if (ignore_count_skip)
return 0;
+ if (is_empty_frame || is_error_frame)
+ return 0;
+
if (stream_skip) {
stream_skip--;
return 0;

Privacy Policy