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 5e59ed3135
Fixes #4477 <https://github.com/Genymobile/scrcpy/issues/4477>
This commit is contained in:
Romain Vimont 2023-11-29 12:16:05 +01:00
parent bf056b1fee
commit 9497f39fb4

View file

@ -426,8 +426,13 @@ scrcpy(struct scrcpy_options *options) {
// still works. // still works.
// <https://github.com/Genymobile/scrcpy/issues/4418> // <https://github.com/Genymobile/scrcpy/issues/4418>
if (SDL_Init(SDL_INIT_VIDEO)) { if (SDL_Init(SDL_INIT_VIDEO)) {
LOGE("Could not initialize SDL video: %s", SDL_GetError()); // If it fails, it is an error only if video playback is enabled
goto end; 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());
}
} }
} }