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

Crash when no sound device is plugged in #4800

Open
TennisRunner opened this issue Mar 31, 2024 · 3 comments
Open

Crash when no sound device is plugged in #4800

TennisRunner opened this issue Mar 31, 2024 · 3 comments

Comments

@TennisRunner
Copy link

Environment

  • OS: Windows 10
  • scrcpy version: 2.3.1
  • installation method: Window Release
  • device model:
  • Android version: 13

When a sound is played on the phone and there is no sound device plugged into the aux of the computer.
SCRCPY crashes with an error message:

ERROR: Could not open audio device: WASAPI can't find requested audio endpoint: Element not found.
ERROR: Demuxer error
WARN: Killing the server...
@rom1v
Copy link
Collaborator

rom1v commented Mar 31, 2024

(it does not crash, it just closes with an error)

Run scrcpy --no-audio-playback.

@TennisRunner
Copy link
Author

Seems like it should automatically skip trying to output audio when no device is available instead instead of closing with an error.

@rom1v
Copy link
Collaborator

rom1v commented Mar 31, 2024

If the audio capture fails on the Android side, there is a mechanism to accept missing audio (because it is expected that audio is not supported on Android < 11, and scrcpy without option should still work if the device audio could not be captured).

However, if there is a problem on the client side, it's more complicated, because the audio device opening failure happens after the device capture is started on the device side (the opening parameters theoretically depends on the decoder format, so the audio stream must be started and decoded).

If audio device opening fails, we could drop all decoded audio frames (as if we played silence), but the behavior would be unexpected: the audio would be forwarded (i.e. captured and disabled from the device), but not played from the computer either.

I understand that if audio client fails, we would like the same behavior as if we passed --no-audio-playback explicitly (which may in turn totally disable audio forwarding or not, depending if there is recording or not)… But it's complicated.

Or we might check before starting the server if at least one sound card is available, to implicitly enable --no-audio-playback, but that does not mean that audio device opening will work… So it would not be very reliable. So it is probably better to fail if audio playback is enabled but not supported (the same way it fails if video is transmitted but no display can be found).

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

No branches or pull requests

2 participants