alvr-org / alvr-visionos

Experimental visionOS client for ALVR - SteamVR on Apple Vision Pro!
MIT License
416 stars 28 forks source link

ALVR hangs for 6 seconds every 29 seconds when streaming #74

Closed thesoftwarejedi closed 6 months ago

thesoftwarejedi commented 6 months ago

When actively in SteamVR, every 29 seconds the view in the headset freezes (but stays in view just moves with head movement), ALVR UI freezes on PC, and sound changes back to the PC, it stays glitched for exactly 6 seconds, then everything returns to normal. 29 seconds later, same happens. These timings are very consistent - I ran a stopwatch on it for several cycles. Of course my reaction time could be off. Perhaps 30 and 5 or such, but its for sure a 35 second cycle.

I have attempted several changes to settings. Quality, bitrate, and encoder does not seem to affect this behavior.

I'm thinking the headset is psuedo disconnecting and reconnecting or something of the sort. The exact timing tells me its not an encoding or network issue, but something in AVP, alvr-visionos, or ALVR having a blip.

Perhaps this is a general ALVR issue and not AVP specific and belongs in the main repo - I'm not sure.

This is a screenshot of the stats chart after a 6 second freeze: Screenshot_173

shinyquagsire23 commented 6 months ago

It could be that the AWDL bug changed how it manifests I guess, does it change if you change your 5GHz WiFi to channel 149?

thesoftwarejedi commented 6 months ago

It could be that the AWDL bug changed how it manifests I guess, does it change if you change your 5GHz WiFi to channel 149?

You pointed out the root cause. I was on a 2.4ghz network. Switched to the 5ghz, all is good now! Flight simulator in 4K VR. Love it.

Very strange behavior though on the other network. I don’t understand why the perfect 35s cycle. If anyone understands and cares to explain I’d love to hear. I’m a 35 years exp software engineer so you can use big words. ;)

Finally - can I tip the authors somewhere?

shinyquagsire23 commented 6 months ago

The 2.4GHz stutter could just be the periodic IDR NALs (fullly encoded frames and not differential ones) the encoder sends out, it's supposed to send them every 100ms but I think like most H264+ encoders, every setting is a suggestion apparently lol. And I've found even on 5GHz, network bandwidth-related lag tends to cause weird feedback issues with the timing/Mbps prediction.

For 5GHz the devil is AWDL, which is some fancy Apple feature they use to do Airplay/Air-whatever file sending. They do it using broadcast packets on channel 149, which means if your AP is on anything except 149, you get these random stutters once a second, for several frames, and sometimes it's there and aometimes it's not.