mirror of
https://github.com/Genymobile/scrcpy.git
synced 2026-04-21 01:33:36 +00:00
Extract video streaming to a separate class
ScreenEncoder handled both capture/encoding and sending over the network. Move the streaming part to a separate VideoStreamer.
This commit is contained in:
parent
3aac74e9e9
commit
87972e2022
3 changed files with 67 additions and 40 deletions
|
|
@ -89,8 +89,8 @@ public final class Server {
|
|||
Size videoSize = device.getScreenInfo().getVideoSize();
|
||||
connection.sendDeviceMeta(Device.getDeviceName(), videoSize.getWidth(), videoSize.getHeight());
|
||||
}
|
||||
ScreenEncoder screenEncoder = new ScreenEncoder(options.getSendFrameMeta(), options.getBitRate(), options.getMaxFps(), codecOptions,
|
||||
options.getEncoderName(), options.getDownsizeOnError());
|
||||
ScreenEncoder screenEncoder = new ScreenEncoder(options.getBitRate(), options.getMaxFps(), codecOptions, options.getEncoderName(),
|
||||
options.getDownsizeOnError());
|
||||
|
||||
Controller controller = null;
|
||||
if (control) {
|
||||
|
|
@ -103,7 +103,8 @@ public final class Server {
|
|||
|
||||
try {
|
||||
// synchronous
|
||||
screenEncoder.streamScreen(device, connection.getVideoFd());
|
||||
VideoStreamer videoStreamer = new VideoStreamer(connection.getVideoFd(), options.getSendFrameMeta());
|
||||
screenEncoder.streamScreen(device, videoStreamer);
|
||||
} catch (IOException e) {
|
||||
// this is expected on close
|
||||
Ln.d("Screen streaming stopped");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue