selkies-project / selkies-gstreamer

Open-Source Low-Latency Accelerated Linux WebRTC HTML5 Remote Desktop Streaming Platform for Self-Hosting, Containers, Kubernetes, or Cloud/HPC
https://selkies-project.github.io/selkies-gstreamer/
Mozilla Public License 2.0
380 stars 48 forks source link

Scale relative cursor speed if client and server resolutions differ #142

Closed PMohanJ closed 7 months ago

PMohanJ commented 7 months ago

Reference the issue numbers and reviewers

98 @ehfd

Explain relevant issues and how this pull request solves them This pull request fixes the issue #98 by implementing the a scaling technique to change the cursor speeds.

Describe the changes in code and its dependencies and justify that they work as intended after testing The changes revolve around detecting if client and server are having different resolutions, if so, we'd introduce the cursorScalingFactor which is then be used to scale the relative cursor speeds by multiplying the relative cursor position (x and y values) with the scalingFactor before sending to server. Thus based on the scaling factor the speed could either increase or decrease to provide smooth user experience.

Describe alternatives you've considered NA

Additional context The code includes a check if the client resolution is the range of delta 10, this is done due to the reason that sometimes the video and window resolution doesn't match quite exactly. Screenshot from 2024-04-17 17-07-47