From 0c86f9cf53be65e8f18ac8471d642e0f466d047e Mon Sep 17 00:00:00 2001 From: Andri Yngvason Date: Fri, 17 Jul 2020 16:22:17 +0000 Subject: [PATCH] screencopy: Don't delay if time_left == 0 --- src/screencopy.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/screencopy.c b/src/screencopy.c index 80b507d..456f5a4 100644 --- a/src/screencopy.c +++ b/src/screencopy.c @@ -172,6 +172,10 @@ static void screencopy_failed(void* data, DTRACE_PROBE1(wayvnc, screencopy_failed, self); screencopy_stop(self); + + wv_buffer_pool_release(self->pool, self->front); + self->front = NULL; + self->status = SCREENCOPY_FAILED; self->on_done(self); } @@ -224,7 +228,6 @@ static void screencopy__poll(void* obj) static int screencopy__start(struct screencopy* self, bool is_immediate_copy) { - if (self->status == SCREENCOPY_IN_PROGRESS) return -1; @@ -232,7 +235,7 @@ static int screencopy__start(struct screencopy* self, bool is_immediate_copy) uint64_t now = gettime_us(); double dt = (now - self->last_time) * 1.0e-6; - double time_left = (1.0 / self->rate_limit - dt - self->delay) * 1.0e3; + int32_t time_left = (1.0 / self->rate_limit - dt - self->delay) * 1.0e3; self->status = SCREENCOPY_IN_PROGRESS;