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. Refs5e59ed3135Refs110b3a16f6Refs #4418 <https://github.com/Genymobile/scrcpy/issues/4418> Refs #4477 <https://github.com/Genymobile/scrcpy/issues/4477>
This commit is contained in:
@@ -419,13 +419,17 @@ scrcpy(struct scrcpy_options *options) {
|
|||||||
sdl_set_hints(options->render_driver);
|
sdl_set_hints(options->render_driver);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initialize the video subsystem even if --no-video or --no-video-playback
|
if (options->video_playback ||
|
||||||
// is passed so that clipboard synchronization still works.
|
(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>
|
// <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());
|
LOGE("Could not initialize SDL video: %s", SDL_GetError());
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (options->audio_playback) {
|
if (options->audio_playback) {
|
||||||
if (SDL_Init(SDL_INIT_AUDIO)) {
|
if (SDL_Init(SDL_INIT_AUDIO)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user