alvr-org / ALVR

Stream VR games from your PC to your headset via Wi-Fi
MIT License
5.24k stars 473 forks source link

High decode latency #2305

Open AngelBePro opened 1 month ago

AngelBePro commented 1 month ago

Description

Randomly getting over 100 ms in decode latency

General Troubleshooting

Environment

Hardware

https://linux-hardware.org/?probe=f8bcd51ea3

Installation

ALVR Version: v20.9.1

ALVR Settings File: session.json

SteamVR Version: SteamVR 2.7.4

Install Type:

OS Name and Version (winver on Windows or grep PRETTY_NAME /etc/os-release on most Linux distributions): Arch Linux

AngelBePro commented 1 month ago

I forgot to point out this only happenes in high bitrate, after more than 60 mbps or so. With a Quest 2.

The-personified-devil commented 1 month ago

The hardware decoders only support a certain amount of bitrate. Now 60 mbps seems pretty low depending on the codec used, but have you checked actual vs expected bitrate in the statistics tab? If the actual is a lot higher then it's probably just maxxing out the hardware decoder. At that point it's basically just a configuration issue and you need to turn down the bitrate or check if you can achieve a better looking configuration with a different encoder.

AngelBePro commented 1 month ago

Here is the statistics tab while I'm playing at 85mbps constant in beat saber. I'm just not sure if the actual bitrate is too high since its always lower than expected. image

AngelBePro commented 1 month ago

I also find out this happens when I rotate at a position but I could be wrong https://imgur.com/a/JP6O0MB

The-personified-devil commented 1 month ago

That's actually really weird. Iirc people reported that decoder latency increases after about 150Mbps for Hevc, but your actual bitrate is still comfortably below that. And the bitrate doesn't seem to increase when decoder latency increases. The only thing I can recommend is using h264 with a higher bitrate for the time being. But this should probably be looked into further.

failboat78 commented 1 month ago

I noticed this as well. It seemed like the bitrate slider was not being respected - and some multiplier was being applied.

Depending on headset HEVC works well if you stay below a certain limit. Seems to be about 200Mbit for quest2/3 - after that it struggles - the symptom of which is huge decode latency.

My fix was to leave the slider alone and not increase it to 200! And to try disable all adaptive stuff.

AngelBePro commented 1 month ago

My friend also uses ALVR via USB (he is using a really good cable) and he is experiencing the same issue at the same bitrate values. Just to point out not sure if it helps

AngelBePro commented 3 weeks ago

What i just learned was that I was on a very low resolution before, 1440 p and now when I use 2144 p no matter the bitrate it just gets to 100 ms. If it is possible im linking my current config, try it out if you have a quest 2 so I can know if its just me or someone else.

failboat78 commented 3 weeks ago

If you set things too high it will cause this. Look at the acual bitrate being sent in the statistics screen - if this goes over 200 you will have problems.

When you say latency is 100ms break that down by looking at statistics - where does most of it come from? If it's decode latency then you are overloading the headset.

Alternatively maybe the latency comes because your pc just cannot run the game at that high resolution. Statistics should show all this.

The bitrate slider in the UI is very misleading - just leave it on the 30 for starters. You will see from statistics that the actual bitrate produces is much higher. With slider on 30 I see peak bitrate produced of about 200, so it works well with quest3 (and maybe quest2).

The-personified-devil commented 3 weeks ago

Did you read the rest of the issue?

failboat78 commented 3 weeks ago

The framerate graph above looks very strange - why does the framerate go so high? Client is set at 120 but streamer is at 90? Try setting them both to 90.

I use 90 and I get a much more stable framerate: image

Even on windows with other streaming software I could never get 120fps with high quality.

The-personified-devil commented 3 weeks ago

The framerate graph above looks very strange - why does the framerate go so high? Client is set at 120 but streamer is at 90? Try setting them both to 90.

The streamer framerate goes rather high, but that doesn't matter, it's a factor that's already included in the bitrate. And both are set at 120, you can literally see the streamer framerate dip below 120 to somewhere around 90 in the graph, it's just one of the low spots. If it were actually at 90 then that would be the middle of the pack, not the bottom. (and that's regardless of the fact that it's impossible to configure deviating framerates and basically impossible for something to fail for them to end up set to deviating values)

AngelBePro commented 3 weeks ago

What helped me so far is foveated encoding, which I normally disable since I find it ruining the quality

AngelBePro commented 3 weeks ago

HDR also made the client fps really bad, but that's only with the foveated encoding. I'm no scientist and I guess that the foveation messes with it somehow. Im going to stick to foveated encoding for now.

zarik5 commented 3 weeks ago

@AngelBePro if you're using latest release or master, foveated encoding uses the old client renderer. There is a new renderer but we ported over only the HDR/color range code. So when you use foveated encoding you're also using the old HDR/color range code.