mirror of
https://github.com/Genymobile/scrcpy
synced 2024-12-29 02:32:15 +00:00
Split SDL initialization
Initialize SDL_INIT_EVENTS first (very quick) and SDL_INIT_VIDEO after the server (quite long).
This commit is contained in:
parent
688477ff65
commit
caf594c90e
@ -258,6 +258,14 @@ scrcpy(struct scrcpy_options *options) {
|
||||
static struct scrcpy scrcpy;
|
||||
struct scrcpy *s = &scrcpy;
|
||||
|
||||
// Minimal SDL initialization
|
||||
if (SDL_Init(SDL_INIT_EVENTS)) {
|
||||
LOGC("Could not initialize SDL: %s", SDL_GetError());
|
||||
return false;
|
||||
}
|
||||
|
||||
atexit(SDL_Quit);
|
||||
|
||||
if (!server_init(&s->server)) {
|
||||
return false;
|
||||
}
|
||||
@ -307,14 +315,12 @@ scrcpy(struct scrcpy_options *options) {
|
||||
sdl_set_hints(options->render_driver);
|
||||
}
|
||||
|
||||
uint32_t flags = options->display ? SDL_INIT_VIDEO : SDL_INIT_EVENTS;
|
||||
if (SDL_Init(flags)) {
|
||||
// Initialize SDL video in addition if display is enabled
|
||||
if (options->display && SDL_Init(SDL_INIT_VIDEO)) {
|
||||
LOGC("Could not initialize SDL: %s", SDL_GetError());
|
||||
goto end;
|
||||
}
|
||||
|
||||
atexit(SDL_Quit);
|
||||
|
||||
sdl_configure(options->display, options->disable_screensaver);
|
||||
|
||||
char device_name[DEVICE_NAME_FIELD_LENGTH];
|
||||
|
Loading…
Reference in New Issue
Block a user