From 9497f39fb47e899df1247942f90eba5daa0cf204 Mon Sep 17 00:00:00 2001 From: Romain Vimont Date: Wed, 29 Nov 2023 12:16:05 +0100 Subject: [PATCH] Do not fail if SDL_INIT_VIDEO fails without video The SDL video subsystem may be initialized so that clipboard synchronization works even without video playback. But if the video subsystem initialization fails (e.g. because no video device is available), consider it as an error only if video playback is enabled. Refs 5e59ed31352251791679e5931d7e5abf0c2d18f6 Fixes #4477 --- app/src/scrcpy.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/app/src/scrcpy.c b/app/src/scrcpy.c index 0b0b8bad..cf2e7e47 100644 --- a/app/src/scrcpy.c +++ b/app/src/scrcpy.c @@ -426,8 +426,13 @@ scrcpy(struct scrcpy_options *options) { // still works. // if (SDL_Init(SDL_INIT_VIDEO)) { - LOGE("Could not initialize SDL video: %s", SDL_GetError()); - goto end; + // If it fails, it is an error only if video playback is enabled + if (options->video_playback) { + LOGE("Could not initialize SDL video: %s", SDL_GetError()); + goto end; + } else { + LOGW("Could not initialize SDL video: %s", SDL_GetError()); + } } }