Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minimal VNC server implementation #3959

Open
wants to merge 8 commits into
base: dev
Choose a base branch
from

Conversation

DavidVentura
Copy link

@DavidVentura DavidVentura commented Apr 30, 2023

Fixes #3473.
I wanted to have a direct VNC server sharing my scrcpy screen -- this is a work in progress towards that.

Code-quality wise it's pretty bad; a lot of copy-pasting the screen/display and just chucked the example libvnc eventloop thread, but it does function!

@DavidVentura DavidVentura changed the title crappy but working vnc impl Minimal VNC server implementation Apr 30, 2023
@DavidVentura DavidVentura marked this pull request as draft April 30, 2023 14:42
@DavidVentura DavidVentura marked this pull request as ready for review May 4, 2023 17:18
@rom1v
Copy link
Collaborator

rom1v commented May 5, 2023

Thank you for the prototype 👍 It's interesting. I keep it in some branch for now.

I'm not sure whether I want to add a VNC server directly in scrcpy (it is a "side" feature, and it typically does not provide the same performances).

I think it might require scrcpy to be a bit more "modular", so that we can compile independent "plugins" (I'm not very happy with the V4L2 sink and its bunch of ifdefs too). But on the other side, I don't want it to be as modular as VLC for example (this would require too much decoupling which add many constraints, that in practice prevent to implement some "simple" features because the abstractions need to be "too general"). An alternative would be to expose a libscrcpy and use this to create a VNC server binary.

These are just random thoughts, I keep the feature/need in mind. Thank you.

@rp1231
Copy link

rp1231 commented May 5, 2023

This seems interesting.
But what does this pr exactly allow you to do?
I tried googling a little bit about vnc servers and understood that it was something about screen sharing......
Thanks

@DavidVentura
Copy link
Author

@rp1231 a VNC server is an implementation of the "remote-framebuffer" protocol, in this case, it allows you to display and interact with the android device from another computer, not necessarily the one that's running scrcpy (and not the one where the device is plugged in).

@rom1v it's not the same performance, but it is pretty good, it feels "the same" when using a device for general purposes (did not try games / video).
It could be made more efficient in certain scenarios; as I didn't figure out a way to detect the "damage" in the video frames, every time something changes, the entire framebuffer is sent.

A libscrcpy would be pretty cool, and yeah, I did feel adding more ifdefs isn't really great. I'll think a bit for a way to refactor these.
I'm fine keeping the PR open - I have my own build so I'm covered

@rp1231
Copy link

rp1231 commented May 6, 2023

@DavidVentura
Thanks for the explanation.
What use case do you use this for?
Especially in the case for scrcpy.

Also sorry for clogging up the pr thread with questions......

@DavidVentura
Copy link
Author

@rp1231 I have a device that I need to access sporadically. I've left it connected to my server and can use VNC to access / interact with it via my laptop.

@rp1231
Copy link

rp1231 commented May 6, 2023

@DavidVentura Ah ok, I see.
Thanks

@DavidVentura
Copy link
Author

@rom1v I had something like this in mind
https://github.com/DavidVentura/scrcpy/pull/1/files
which can be extended to cover also V4L2 -- mostly it moves all the ifdef'd state into a plugin, which bypasses most of the ifdefs by having the plugin-specific data as an opaque void*

@mudebug77
Copy link

Thank you for sharing, this is a great suggestion. With VNC, it can be better expanded.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants