exelix11 / SysDVR

Stream switch games to your PC via USB or network
GNU General Public License v2.0
1.46k stars 89 forks source link

[Bug] Audio Delay on Android Client #271

Closed mitkan191003 closed 7 months ago

mitkan191003 commented 7 months ago

Describe the bug When using the android client with a USB cable and default settings or synchronized audio player mode, I'm experiencing ~400ms of latency, but only on the audio stream. Video seems to have no latency. Is this a limitation of Android or is there a setting I need to change?

To Reproduce

  1. Connect Android phone with USB cable.
  2. Start Audio+Video or Audio only stream.
  3. Test for audio latency.
  4. Audio should be slightly behind the video stream and console screen.

Expected behavior Audio should be synchronized with the video stream.

Setup information

Additional context isCompatibleAudioStream is false in the debug info if it helps.

Also, thank you for making this. It's saved me so much hassle with capture cards and HDMI cables. I really appreciate your work.

exelix11 commented 7 months ago

I did some quick testing by listening with a headphone jack from my phone and there is indeed some latency but it doesn't feel as bad as half a second.

You can try reducing audio batching in the settings as well as disabling stream synchronization, maybe disabling streaming fps cap also helps.

How are you measuring latency ? Stuff like wireless headphones are known to have some delay.

I'll look into it but I don't think there's a fix for this.

mitkan191003 commented 7 months ago

You're right I measured it again by putting a microphone between the switch's and my phone's speakers and measured the gap in audacity, and it seems to be ~260ms. I'll try playing with those settings and see if it helps. Audio

Edit: Tested and with batching set to 0, the latency fluctuated from 200ms to 290ms. Uncapping the streaming framerate added about 80ms of latency.

mitkan191003 commented 7 months ago

After testing with multiple USB hubs, cables, and a Google Pixel 7 too, I've found that the delay is inconsistent but present through all combinations. Unfortunately, I don't know enough about Android development to debug this, so I'll continue to use the desktop client for now. Thank you for your time though.