mirror of
https://github.com/Genymobile/scrcpy.git
synced 2025-08-03 06:39:39 +00:00
Set SDL hints before creating any thread
To avoid race conditions in SDL (reported by TSAN).
This commit is contained in:
parent
fd0f432e87
commit
4dca08cfe3
1 changed files with 6 additions and 4 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue