3 ms·
If it's so simple, why does it take 30k or so lines of code for scrcpy to do it?
by jampekka 3y ago
If it's so simple, why does it take 30k or so lines of code for scrcpy to do it?
- charcircuit 3y agoBecause there are a lot of features beyond just streaming a screen capture, it supports many versions of Android, and it is a polished utility. The actually screen recording part is simple since you are just using existing Android APIs to have hook up the diplay server to a media encoder and the media encoder to the network. https://github.com/Genymobile/scrcpy/blob/a3cdf1a6b86ea22786e1f7d09b9c202feabc6949/server/src/main/java/com/genymobile/scrcpy/ScreenEncoder.java https://github.com/Genymobile/scrcpy/blob/a3cdf1a6b86ea22786...
- jampekka 3y agoThat is reasonablish as video APIs go. But it's quite a small part of all scrcpy has to do to mirror the screen over the network. Most of that code would be covered with something like "gst-launch pipewiresrc ! encodebin" and the whole mirroring with adding a few elements. Well, in theory at least; gstreamer has the habbit of getting quite fiddly oftentimes. But I don't see any fundamental problems why this too couldn't work with simple composable tools.