Skip to content

Commit

Permalink
Do not fail if SDL_INIT_VIDEO fails without video
Browse files Browse the repository at this point in the history
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 5e59ed3
Fixes #4477 <#4477>
  • Loading branch information
rom1v committed Nov 29, 2023
1 parent bf056b1 commit 9497f39
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions app/src/scrcpy.c
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
}
}

Expand Down

0 comments on commit 9497f39

Please sign in to comment.