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

Add ability to setup server by config file #5153

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

kuzalekon
Copy link

Greetings!

My colleagues and I are working on a "Mobile Farm" project.
While working, I came across a problem with Samsung devices described in #2841. If a certain number of characters was exceeded during an attempt to start the scrcpy-server, the process crashed with an error. And to solve this problem, I decided to make it possible to transfer the list of required options through a server configuration file.

Along the way, I reworked the parsing of options, using FileReader/StringReader + Properties classes.

Closes #2841

@rom1v
Copy link
Collaborator

rom1v commented Jul 30, 2024

Thank you for the PR.

One problem I see is that the server parameters are "internal", so the user should not create a file containing the "private" server key/value pairs to pass to --server-config.

In theory, the client is in charge to construct and pass the necessary parameters to the server, so it should not be exposed via a command line argument.

I have no good solution for now.

One possibility would be to make the client always write a file, push it to the server, and the server would parse it (as you do). But I don't like pushing a separate file, it would add more problems (possible race conditions, typically when multiple scrcpy instances are started "simultaneously" for the same device, etc.). And in practice it would add a small starting delay, while it is almost always unnecessary.

Another possibility would be to pass only some parameters via command line arguments to the server (the one necessary to correctly establish the communication with the client), and pass the remaining ones on a socket (in addition to the video, audio or control socket). But it adds some complexity, and complicates using a standalone scrcpy-server (unless we allow both).

Yet another possibility could be to "compress" the arguments keys and values (currently, they are particularly verbose, for example true for a boolean, etc.).

@kuzalekon
Copy link
Author

Thank You for the answer @rom1v

I agree that these are internal server details. but no one forces the user to write such a configuration file. They are may not use this opportunity at all. But quite a lot of projects use only the scrcpy-server and encounter problems from #2841.

I have these suggestions:

  1. Remove the ability to specify a configuration file using the client command line. But leave this option in the scrcpy-server.
  2. Implement the functionality of the optional “conversion” of command line arguments into a file and its subsequent transfer before starting the server. To activate this method of starting the server, you will also need to add a command line argument (I think what it could be called).

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.

Stack corruption detected when using version 1.21
2 participants