summaryrefslogtreecommitdiff
path: root/live.c
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2011-10-05 16:19:37 +0200
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2011-10-05 16:24:32 +0200
commit1f78a50ce5667c540d53dfe274ec068141c132fd (patch)
tree31b60d50c1cd5e3f43df9ca2f952e9a197f15aaa /live.c
parent528154acaf9ab372c69b16d1e895e1556f25119f (diff)
live: Use global frame count to display the FPS counter
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'live.c')
-rw-r--r--live.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/live.c b/live.c
index 77587cb..4a920c5 100644
--- a/live.c
+++ b/live.c
@@ -57,8 +57,8 @@
#define SELECT_TIMEOUT 2000 /* in milliseconds */
static struct timespec fps_ts = { 0, 0 };
-static unsigned int fps_count = 0;
-static bool show_fps = true;
+static unsigned int fps_last = 0;
+static bool fps_show = true;
static unsigned int frame_count = 0;
static unsigned int frame_skip = 0;
@@ -174,19 +174,18 @@ static void viewfinder_process(struct omap3_isp_device *isp __attribute__((__unu
frame_count++;
- if (show_fps){
- fps_count++;
-
+ if (fps_show){
clock_gettime(CLOCK_MONOTONIC, &ts);
interval = ts.tv_sec - fps_ts.tv_sec;
interval += (ts.tv_nsec - fps_ts.tv_nsec) / 1000000000.0;
if (interval >= 5) {
- if (fps_count > 1)
- printf("frame rate: %f fps\n", fps_count / interval);
+ if (frame_count > 1)
+ printf("frame rate: %f fps\n",
+ (frame_count - fps_last) / interval);
- fps_count = 0;
+ fps_last = frame_count;
fps_ts = ts;
}
}