Skip to content

Display and control your Android device

Always initialize SDL with the video subsystem

Romain Vimont5e59ed313522
diff --git a/app/src/scrcpy.c b/app/src/scrcpy.c
index 1d0e90c1..ac2b8e33 100644
--- a/app/src/scrcpy.c
+++ b/app/src/scrcpy.c
@@ -417,10 +417,14 @@ scrcpy(struct scrcpy_options *options) {
if (options->video_playback) {
sdl_set_hints(options->render_driver);
- if (SDL_Init(SDL_INIT_VIDEO)) {
- LOGE("Could not initialize SDL video: %s", SDL_GetError());
- goto end;
- }
+ }
+
+ // 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>
+ if (SDL_Init(SDL_INIT_VIDEO)) {
+ LOGE("Could not initialize SDL video: %s", SDL_GetError());
+ goto end;
}
if (options->audio_playback) {