From 899cdb4c001ccaab4d40b7a33d6b584b5c7eb903 Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Fri, 26 Feb 2016 23:44:58 -0800 Subject: [PATCH] GUAC-236: Fully implement sync instruction. Stub timestamp update for display. --- src/guacenc/display.c | 14 ++++++++++++++ src/guacenc/instruction-sync.c | 5 ++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/guacenc/display.c b/src/guacenc/display.c index 6a1e32c8..9e18bd01 100644 --- a/src/guacenc/display.c +++ b/src/guacenc/display.c @@ -22,14 +22,28 @@ #include "config.h" #include "display.h" +#include "log.h" +#include #include #include int guacenc_display_sync(guacenc_display* display, guac_timestamp timestamp) { + + /* Verify timestamp is not decreasing */ + if (timestamp < display->last_sync) { + guacenc_log(GUAC_LOG_DEBUG, "Decreasing sync timestamp"); + return 1; + } + + /* Update timestamp of display */ + display->last_sync = timestamp; + /* STUB */ + return 0; + } guacenc_display* guacenc_display_alloc() { diff --git a/src/guacenc/instruction-sync.c b/src/guacenc/instruction-sync.c index ab789724..64255100 100644 --- a/src/guacenc/instruction-sync.c +++ b/src/guacenc/instruction-sync.c @@ -75,9 +75,8 @@ int guacenc_handle_sync(guacenc_display* display, int argc, char** argv) { /* Parse arguments */ guac_timestamp timestamp = guacenc_parse_timestamp(argv[0]); - /* STUB */ - guacenc_log(GUAC_LOG_DEBUG, "sync: timestamp=%" PRId64, timestamp); - return 0; + /* Update timestamp / flush frame */ + return guacenc_display_sync(display, timestamp); }