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

Forward audio #3703

Closed
wants to merge 8 commits into from
Closed

Forward audio #3703

wants to merge 8 commits into from

Conversation

yume-chan
Copy link
Contributor

@yume-chan yume-chan commented Jan 29, 2023

Related to #14

Android version support:

  • Android 10 or older: Not supported. com.android.shell package doesn't have RECORD_AUDIO permission declared.
  • Android 11: Using the "Share heap dump" hack to bypass Android foreground check. The dialog is closed after AudioRecord started. Plus the FakePackageNameContext hack to "fix" Android permission check.
  • Android 12 or newer: Using another variant of FakePackageNameContext hack to "fix" Android permission check. No "Share heap dump" hack required.

New option:

--no-forward-audio on client side, forward_audio on server side. Forwarding is enabled by default.

Socket order:

video -> [control] -> [audio]

Control and audio sockets may be absent if --no-control or --no-forward-audio is specified, but the order is maintained.

Audio compression:

No compression used, so the audio stream can be easily played at client side. The bandwidth is 48000Hz x 16bits x 2 channels = 1536000 bits =192000 bytes = 192KB = 187.5KiB per second, so I don't think it needs compression (at least on wired connection).

Latency:

The latency is around 30ms, tested in a rhythm game. And in one hour of continue using, the latency is seemingly increasing. Maybe it still requires packet header and time-stamping.

@yume-chan yume-chan changed the base branch from master to dev January 30, 2023 13:13
yume-chan and others added 7 commits January 30, 2023 21:39
For the initial connection between the device and the computer, an adb
tunnel is established (with "adb reverse" or "adb forward").

The device-side of the tunnel is a local socket having the hard-coded
name "scrcpy". This may cause issues when several scrcpy instances are
started in a few seconds for the same device, since they will try to
bind the same name.

To avoid conflicts, make the client generate a random UID, and append
this UID to the local socket name ("scrcpy_01234567").
This was referenced Feb 26, 2023
Closed
@yume-chan
Copy link
Contributor Author

Replaced by #3757

@yume-chan yume-chan closed this Feb 27, 2023
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.

2 participants