@@ -91,8 +91,6 @@ private static void scrcpy(Options options) throws IOException, ConfigurationExc
91
91
Size videoSize = device .getScreenInfo ().getVideoSize ();
92
92
connection .sendDeviceMeta (Device .getDeviceName (), videoSize .getWidth (), videoSize .getHeight ());
93
93
}
94
- ScreenEncoder screenEncoder = new ScreenEncoder (codec .getMimeType (), options .getBitRate (), options .getMaxFps (), codecOptions ,
95
- options .getEncoderName (), options .getDownsizeOnError ());
96
94
97
95
if (control ) {
98
96
controller = new Controller (device , connection , options .getClipboardAutosync (), options .getPowerOn ());
@@ -102,9 +100,11 @@ private static void scrcpy(Options options) throws IOException, ConfigurationExc
102
100
device .setClipboardListener (text -> controllerRef .getSender ().pushClipboardText (text ));
103
101
}
104
102
103
+ VideoStreamer videoStreamer = new VideoStreamer (connection .getVideoFd (), codec , options .getSendCodecId (), options .getSendFrameMeta ());
104
+ ScreenEncoder screenEncoder = new ScreenEncoder (codec .getMimeType (), options .getBitRate (), options .getMaxFps (), codecOptions ,
105
+ options .getEncoderName (), options .getDownsizeOnError ());
105
106
try {
106
107
// synchronous
107
- VideoStreamer videoStreamer = new VideoStreamer (connection .getVideoFd (), codec , options .getSendCodecId (), options .getSendFrameMeta ());
108
108
screenEncoder .streamScreen (device , videoStreamer );
109
109
} catch (IOException e ) {
110
110
// Broken pipe is expected on close, because the socket is closed by the client
0 commit comments