mirror of
https://github.com/Genymobile/scrcpy
synced 2025-02-17 21:16:59 +00:00
Do not initialize SDL video when not necessary
The SDL video subsystem is required for video playback and clipboard synchronization. If neither is used, it is not necessary to initialize it. Refs5e59ed3135
Refs110b3a16f6
Refs #4418 <https://github.com/Genymobile/scrcpy/issues/4418> Refs #4477 <https://github.com/Genymobile/scrcpy/issues/4477>
This commit is contained in:
parent
140a49b8be
commit
bf056b1fee
@ -419,12 +419,16 @@ scrcpy(struct scrcpy_options *options) {
|
||||
sdl_set_hints(options->render_driver);
|
||||
}
|
||||
|
||||
// Initialize the video subsystem even if --no-video or --no-video-playback
|
||||
// is passed so that clipboard synchronization 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 (options->video_playback ||
|
||||
(options->control && options->clipboard_autosync)) {
|
||||
// Initialize the video subsystem even if --no-video or
|
||||
// --no-video-playback is passed so that clipboard synchronization
|
||||
// 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 (options->audio_playback) {
|
||||
|
Loading…
Reference in New Issue
Block a user