moonlight-stream / moonlight-android

GameStream client for Android
GNU General Public License v3.0
4.3k stars 682 forks source link

[Issue]: FireTV 4K Audio carckling and Stream crash #1193

Open Blitzritze opened 1 year ago

Blitzritze commented 1 year ago

I use sunshine instead of Nvidia GameStream

Describe the bug

As soon as I start the stream, no matter if desktop or directly into a game, the stream crashes as soon as sound comes from the host device.

Steps to reproduce

When the stream does not crash immediately, I went to Youtube and started a video. When the sound is on, the stream immediately starts lagging as if the bitrate is too high. (Moonlight says "connection slow try to lower the bitrate). But as soon as I mute the sound from the video, everything runs without problems.

Affected games

Complete stream

Moonlight adjusted settings

Yes

Moonlight adjusted settings (please complete the following information)

Enable/Disabled Play audio on PC Testet all Resolutions and FPS Tested all Audio Setting (Stereo, 5.1 and 7.1) HDR enabled and disabled changed bitrate Host PC Changed Sound Output from 48khz to 32khz

Moonlight default settings

Yes

Android version

FireOS 6.2.9.5

Device model

FireTV 4K

Server PC OS version

Windows 11 22H2 (22621.1265)

Server PC GeForce Experience version

3.27.0.112

Server PC Nvidia GPU driver version

531.18

Server PC antivirus and firewall software

Windows Defender

WillWill56 commented 1 year ago

Having the same issue, streaming from Windows 10 to a Firestick 4K Max, using GeForce Experience 3.27.0.112 and nvidia driver version 528.49. Moonlight loses connection when launching Steam Big Picture, and after resuming the stream it stays connected, but with the mentioned audio problems.

Audio crackling seems to be reduced when using 5.1 surround compared to stereo, but in both cases audio seems to have a roughly 500ms delay. Video seems unaffected as far as I can tell. I'll do a bit more testing and see what else I can figure out.

Blitzritze commented 1 year ago

The problem is, as soon as audio is played from the host the stream crashes 90% of the time. Unfortunately, no audio setting has changed anything by me.

WillWill56 commented 1 year ago

I switched from Nvidia Gamestream to Sunshine and that has solved the crackling audio and disconnects for me. Might be worth checking to make sure you properly disabled gamestream in GeForce Experience. Moonlight could still be connecting to that if you used it in the past.

Blitzritze commented 1 year ago

I switched from Nvidia Gamestream to Sunshine and that has solved the crackling audio and disconnects for me. Might be worth checking to make sure you properly disabled gamestream in GeForce Experience. Moonlight could still be connecting to that if you used it in the past.

Thanks I'll check, is there any other setting besides the one in Nvidia Experience to turn it off? Until now, I have only ever entered a PIN in Sunshine, never anywhere else.

Blitzritze commented 1 year ago

I switched from Nvidia Gamestream to Sunshine and that has solved the crackling audio and disconnects for me. Might be worth checking to make sure you properly disabled gamestream in GeForce Experience. Moonlight could still be connecting to that if you used it in the past.

Thanks I'll check, is there any other setting besides the one in Nvidia Experience to turn it off? Until now, I have only ever entered a PIN in Sunshine, never anywhere else.

Unfortunately, it did not help. GameStream was already disabled. I have reinstalled Sunshine but it did not help.

WillWill56 commented 1 year ago

Strange, I changed back to Nvidia Gamestream, and while it still drops connection at the start of a session, the audio crackling is gone. I'm not sure what else I've changed. I think I did unplug power to the Firestick at one point, worth a try, maybe power cycle everything involved and see if that helps. Otherwise it might be time to check the Sunshine logs and see if anything stands out.

Blitzritze commented 1 year ago

Strange, I changed back to Nvidia Gamestream, and while it still drops connection at the start of a session, the audio crackling is gone. I'm not sure what else I've changed. I think I did unplug power to the Firestick at one point, worth a try, maybe power cycle everything involved and see if that helps. Otherwise it might be time to check the Sunshine logs and see if anything stands out.

Unfortunately, removing the power cord didn't help. I had a game open this time and the stream didn't crash right away but just lagged, regardless of whether audio was streaming or not. What exactly would you need from the logs? Are the logs directly from the Sunshine surface sufficient? I only noticed that the resolution of the virtual desktop was extremely high: 5760x1083 but the log level was only set to info.

WillWill56 commented 1 year ago

What exactly would you need from the logs? Are the logs directly from the Sunshine surface sufficient? I only noticed that the resolution of the virtual desktop was extremely high: 5760x1083 but the log level was only set to info.

Yeah that's all I was thinking of checking, anything in the log file that seems out of place. Log level of info should be enough detail, it would include any warning or error messages from the disconnects if there were any. Maybe someone else with more experience could make use of a debug-level log file.

The virtual desktop having a high resolution is odd but I'm not sure if it's the problem, since the connection drops seem audio related. On that note, have you tried testing with something that's audio only to see if it causes the problem, like playing music? The only other thing I can think of is to continue experimenting with bitrate and frame pacing, or maybe the WiFi connection, e.g. changing channels.

Blitzritze commented 1 year ago

I updated Sunshine to the latest version and tested it again with my FireTV and now I see this error message in the logs

Error: Broadcast video failed send_to: A socket operation could not be executed because the system lacked buffer space or a queue was full [system:10055 at D:/a/_temp/msys64/mingw64/include/boost/asio/detail/win_iocp_socket_service.hpp:330 in function 'send_to']

EDIT: I just looked at the time in the logs and it looks like the error has to do with another device that I have disconnected. it is a laptop and with it everything works.

2023:04:08:19:11:25: Info: CLIENT CONNECTED

Device Description : NVIDIA GeForce RTX 3070 Device Vendor ID : 0x000010DE Device Device ID : 0x00002484 Device Video Mem : 8031 MiB Device Sys Mem : 0 MiB Share Sys Mem : 16356 MiB Feature Level : 0x0000B100 Capture size : 1920x1080 Offset : 1920x2 Virtual Desktop : 5760x1083 2023:04:08:19:11:25: Info: Desktop resolution 1920x1080: Info: Desktop format [DXGI_FORMAT_B8G8R8A8_UNORM]

Colorspace : DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P709 Bits Per Color : 8 Red Primary : [0.639648,0.330078] Green Primary : [0.299805,0.599609] Blue Primary : [0.149414,0.0595703] White Point : [0.3125,0.329102] Min Luminance : 0.5 nits Max Luminance : 270 nits Max Full Luminance : 270 nits 2023:04:08:19:11:25: Info: Capture format DXGI_FORMAT_B8G8R8A8_UNORM: Info: SDR color coding Rec. 601: Info: Color range: [MPEG] [2023:04:08:19:39:28]: Error: Broadcast video failed send_to: Ein Socketvorgang konnte nicht ausgef�hrt werden, da dem System Pufferspeicher fehlte oder eine Warteschlange voll war [system:10055 at D:/a/_temp/msys64/mingw64/include/boost/asio/detail/win_iocp_socket_service.hpp:330 in function 'send_to'] [2023:04:08:20:00:01]: Info: CLIENT DISCONNECTED

I tested it again to see if the error message comes up again. But that was not the case. EDIT: This is the connection from the FireTV stick with which I have the problems

[2023:04:08:20:06:54]: Info: CLIENT CONNECTED

Device Description : NVIDIA GeForce RTX 3070 Device Vendor ID : 0x000010DE Device Device ID : 0x00002484 Device Video Mem : 8031 MiB Device Sys Mem : 0 MiB Share Sys Mem : 16356 MiB Feature Level : 0x0000B100 Capture size : 1920x1080 Offset : 1920x2 Virtual Desktop : 5760x1083 2023:04:08:20:06:55: Info: Desktop resolution 1920x1080: Info: Desktop format [DXGI_FORMAT_B8G8R8A8_UNORM]

Colorspace : DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P709 Bits Per Color : 8 Red Primary : [0.639648,0.330078] Green Primary : [0.299805,0.599609] Blue Primary : [0.149414,0.0595703] White Point : [0.3125,0.329102] Min Luminance : 0.5 nits Max Luminance : 270 nits Max Full Luminance : 270 nits 2023:04:08:20:06:55: Info: Capture format DXGI_FORMAT_B8G8R8A8_UNORM: Info: SDR color coding Rec. 709: Info: Color range: [MPEG] [2023:04:08:20:08:05]: Info: 192.168.178.22: Ping Timeout

This time it only says "[2023:04:08:20:08:05]: Info: 192.168.178.22: Ping Timeout"

Blitzritze commented 1 year ago

Tested again today and it suddenly works

Blitzritze commented 1 year ago

Unfortunately, it still does not work. However, I was able to specify the problem more precisely. The problem strangely only affects the FireTV sticks when they are in the 5Ghz wifi, when they are in the 2.4Ghz wifi it works without problems. Other devices have no problems with Sunshine/Moonlight in the 5Ghz wifi.

Now the question is whether it is due to my network, which I doubt since other devices have no problems or simply a problem of the FireTV sticks.

Can anyone else confirm such problems?

Lucide commented 1 year ago

I have the been experiencing the same issue on a non 4K FireTV stick (sheldonp) on 1080p streams. Audio crackles every 30 seconds or so, making faint low frequency bubbly noises. I've been experiencing crashes as well between 10 and 60 minutes apart. In my case, the whole stick panics and reboots. I'm using an usb ethernet adapter (tried with two different models).

Strangely enough, I've left a stream going for many hours of a high entropy content (?) without crashes. I've collected system logs with logcat during the test and found no outstanding issues. I've also done a hw stress test to rule out overheating-related crashes.

The streams often freezes as well, but a reconnect fixes the issues for a bit. This sounds more like a different issue altogether tracked here.

kentyman23 commented 11 months ago

My Fire TV Stick 4K Max 1st Gen (2021) has a lot of static/crackling/popping noises, too. I don't have the crashing issue.