From 310f5721d95b4af10bf1eb5881282615aa57e6bf Mon Sep 17 00:00:00 2001 From: Romain Vimont Date: Sun, 13 Jun 2021 22:32:36 +0200 Subject: [PATCH] Move file_handler initialization This will allow to (properly) reference the controller from the file_handler initializer. --- app/src/scrcpy.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/app/src/scrcpy.c b/app/src/scrcpy.c index 17902156..8247cef2 100644 --- a/app/src/scrcpy.c +++ b/app/src/scrcpy.c @@ -297,14 +297,6 @@ scrcpy(const struct scrcpy_options *options) { goto end; } - if (options->display && options->control) { - if (!file_handler_init(&s->file_handler, s->server.serial, - options->push_target)) { - goto end; - } - file_handler_initialized = true; - } - struct decoder *dec = NULL; bool needs_decoder = options->display; #ifdef HAVE_V4L2 @@ -353,6 +345,12 @@ scrcpy(const struct scrcpy_options *options) { goto end; } controller_started = true; + + if (!file_handler_init(&s->file_handler, s->server.serial, + options->push_target)) { + goto end; + } + file_handler_initialized = true; } const char *window_title =