Initialize only video subsystem in screen.c
SDL may initialize several subsystems (e.g. video and audio). Initialize only video in screen.c, and call SQL_Quit in any case.
This commit is contained in:
parent
78da66f126
commit
14112d8b11
@ -292,5 +292,7 @@ int main(int argc, char *argv[]) {
|
|||||||
|
|
||||||
avformat_network_deinit(); // ignore failure
|
avformat_network_deinit(); // ignore failure
|
||||||
|
|
||||||
|
SDL_Quit();
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
@ -139,7 +139,7 @@ SDL_bool scrcpy(const struct scrcpy_options *options) {
|
|||||||
LOGW("Cannot request to keep default signal handlers");
|
LOGW("Cannot request to keep default signal handlers");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!sdl_init_and_configure()) {
|
if (!sdl_video_init()) {
|
||||||
ret = SDL_FALSE;
|
ret = SDL_FALSE;
|
||||||
goto finally_destroy_server;
|
goto finally_destroy_server;
|
||||||
}
|
}
|
||||||
|
@ -10,14 +10,12 @@
|
|||||||
|
|
||||||
#define DISPLAY_MARGINS 96
|
#define DISPLAY_MARGINS 96
|
||||||
|
|
||||||
SDL_bool sdl_init_and_configure(void) {
|
SDL_bool sdl_video_init(void) {
|
||||||
if (SDL_Init(SDL_INIT_VIDEO)) {
|
if (SDL_InitSubSystem(SDL_INIT_VIDEO)) {
|
||||||
LOGC("Could not initialize SDL: %s", SDL_GetError());
|
LOGC("Could not initialize SDL video: %s", SDL_GetError());
|
||||||
return SDL_FALSE;
|
return SDL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
atexit(SDL_Quit);
|
|
||||||
|
|
||||||
// Use the best available scale quality
|
// Use the best available scale quality
|
||||||
if (!SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "2")) {
|
if (!SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "2")) {
|
||||||
LOGW("Could not enable bilinear filtering");
|
LOGW("Could not enable bilinear filtering");
|
||||||
|
@ -35,7 +35,7 @@ struct screen {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// init SDL and set appropriate hints
|
// init SDL and set appropriate hints
|
||||||
SDL_bool sdl_init_and_configure(void);
|
SDL_bool sdl_video_init(void);
|
||||||
|
|
||||||
// initialize default values
|
// initialize default values
|
||||||
void screen_init(struct screen *screen);
|
void screen_init(struct screen *screen);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user