Skip to content

Display and control your Android device

Do not fail if SDL_INIT_VIDEO fails without video

Romain Vimont9497f39fb47e
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.
// <https://github.com/Genymobile/scrcpy/issues/4418>
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());
+ }
}
}