From 0f6ddf2db344a3044d7f8a7dfe472a2bb0d33598 Mon Sep 17 00:00:00 2001 From: Martin Pulec Date: Sun, 17 Jan 2021 17:03:03 +0100 Subject: [PATCH] Updated libug sender example --- test_libug_sender.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/test_libug_sender.c b/test_libug_sender.c index c7bc8e538..c81cc76e6 100644 --- a/test_libug_sender.c +++ b/test_libug_sender.c @@ -78,15 +78,16 @@ int main(int argc, char *argv[]) { size_t len = WIDTH * HEIGHT * 4; unsigned char *test = malloc(len); fill(test, WIDTH, HEIGHT, UG_RGBA); - int frames = 0; + uint32_t frames = 0; + uint32_t frames_last = 0; while (1) { - ug_send_frame(s, test, UG_RGBA, WIDTH, HEIGHT); + ug_send_frame(s, (char *) test, UG_RGBA, WIDTH, HEIGHT, frames); frames += 1; time_t seconds = time(NULL) - t0; if (seconds > 0) { - printf("Sent %d frames in last %ld second%s.\n", frames, seconds, seconds > 1 ? "s" : ""); + printf("Sent %d frames in last %ld second%s.\n", frames - frames_last, seconds, seconds > 1 ? "s" : ""); t0 += seconds; - frames = 0; + frames_last = frames; } usleep(1000 * 1000 / FPS); }