From 1945804624c0eb1ef51e6c9a95c33dd8732455c1 Mon Sep 17 00:00:00 2001 From: fryshorts Date: Sat, 25 Oct 2014 16:48:21 +0200 Subject: [PATCH] linux-v4l2: Make frame counter local. This replaces the var in the source struct that was used to print out the number of captured frames with a local one. --- plugins/linux-v4l2/v4l2-input.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/plugins/linux-v4l2/v4l2-input.c b/plugins/linux-v4l2/v4l2-input.c index ae7c6ff30..4d4e04a3b 100644 --- a/plugins/linux-v4l2/v4l2-input.c +++ b/plugins/linux-v4l2/v4l2-input.c @@ -71,9 +71,6 @@ struct v4l2_data { int height; int linesize; struct v4l2_buffer_data buffers; - - /* statistics */ - uint64_t frames; }; /* forward declarations */ @@ -139,6 +136,7 @@ static void *v4l2_thread(void *vptr) int r; fd_set fds; uint8_t *start; + uint64_t frames; uint64_t first_ts; struct timeval tv; struct v4l2_buffer buf; @@ -148,8 +146,8 @@ static void *v4l2_thread(void *vptr) if (v4l2_start_capture(data->dev, &data->buffers) < 0) goto exit; - first_ts = 0; - data->frames = 0; + frames = 0; + first_ts = 0; v4l2_prep_obs_frame(data, &out, plane_offsets); while (os_event_try(data->event) == EAGAIN) { @@ -182,7 +180,7 @@ static void *v4l2_thread(void *vptr) out.timestamp = data->sys_timing ? os_gettime_ns() : timeval2ns(buf.timestamp); - if (!data->frames) + if (!frames) first_ts = out.timestamp; out.timestamp -= first_ts; @@ -197,10 +195,10 @@ static void *v4l2_thread(void *vptr) break; } - data->frames++; + frames++; } - blog(LOG_INFO, "Stopped capture after %"PRIu64" frames", data->frames); + blog(LOG_INFO, "Stopped capture after %"PRIu64" frames", frames); exit: v4l2_stop_capture(data->dev);