Set SDL hints before creating any thread

To avoid race conditions in SDL (reported by TSAN).
upgrade_libusb_1_0_27
Romain Vimont 3 months ago
parent fd0f432e87
commit 4dca08cfe3

@ -409,6 +409,12 @@ scrcpy(struct scrcpy_options *options) {
return SCRCPY_EXIT_FAILURE; return SCRCPY_EXIT_FAILURE;
} }
if (options->video_playback) {
// Set hints before starting the server thread to avoid race conditions
// in SDL
sdl_set_hints(options->render_driver);
}
if (!sc_server_start(&s->server)) { if (!sc_server_start(&s->server)) {
goto end; goto end;
} }
@ -425,10 +431,6 @@ scrcpy(struct scrcpy_options *options) {
assert(!options->video_playback || options->video); assert(!options->video_playback || options->video);
assert(!options->audio_playback || options->audio); assert(!options->audio_playback || options->audio);
if (options->video_playback) {
sdl_set_hints(options->render_driver);
}
if (options->video_playback || if (options->video_playback ||
(options->control && options->clipboard_autosync)) { (options->control && options->clipboard_autosync)) {
// Initialize the video subsystem even if --no-video or // Initialize the video subsystem even if --no-video or

Loading…
Cancel
Save