Genymobile / scrcpy

Display and control your Android device
Apache License 2.0
112.14k stars 10.72k forks source link

Audio Forwarding stops after launching OBS #4654

Open dhruvasagar opened 9 months ago

dhruvasagar commented 9 months ago

Environment

Describe the bug scrcpy works, with audio forwarding with both wireless & usb cable, however, as soon as I launch OBS the audio is lost. I enabled 'Monitor and Output' in OBS advanced properties but that did not have any effect.

Would appreciate any help in troubleshooting.

I notice these debug logs when OBS is running which may hint at something odd. Without OBS, it's typically Buffer underflow.

DEBUG: [Audio] Buffering threshold exceeded, skipping 960 samples
DEBUG: [Audio] Buffering threshold exceeded, skipping 960 samples
DEBUG: [Audio] Buffering threshold exceeded, skipping 960 samples
DEBUG: [Audio] Buffering threshold exceeded, skipping 480 samples
DEBUG: [Audio] Buffering threshold exceeded, skipping 960 samples
DEBUG: [Audio] Buffering threshold exceeded, skipping 960 samples
DEBUG: [Audio] Buffering threshold exceeded, skipping 960 samples
DEBUG: [Audio] Buffering threshold exceeded, skipping 960 samples
DEBUG: [Audio] Buffering threshold exceeded, skipping 960 samples
DEBUG: [Audio] Buffering threshold exceeded, skipping 240 samples
DEBUG: [Audio] Buffering threshold exceeded, skipping 942 samples
DEBUG: [Audio] Buffering threshold exceeded, skipping 461 samples
DEBUG: [Audio] Buffering threshold exceeded, skipping 941 samples
DEBUG: [Audio] Buffering threshold exceeded, skipping 461 samples
DEBUG: [Audio] Buffering threshold exceeded, skipping 941 samples
DEBUG: [Audio] Buffering threshold exceeded, skipping 127 samples
dhruvasagar commented 9 months ago

I did another test on Linux and this does not seem to be a problem on linux so is macOS specific.

rom1v commented 9 months ago

DEBUG: [Audio] Buffering threshold exceeded, skipping 960 samples DEBUG: [Audio] Buffering threshold exceeded, skipping 960 samples DEBUG: [Audio] Buffering threshold exceeded, skipping 960 samples

Technically, the audio output SDL callback is not called often enough (so there is more data received than data played).

You might try to increase the audio output buffer, at the cost of latency (and indirectly more buffer underflows):

scrcpy --audio-output-buffer=10  # in milliseconds, default is 5
dhruvasagar commented 9 months ago

@rom1v Thanks for your response. Will give that a shot.