LizardByte / Sunshine

Self-hosted game stream host for Moonlight.
http://app.lizardbyte.dev/Sunshine/
GNU General Public License v3.0
20.03k stars 963 forks source link

Sound cracking on Streaming Speaker #1389

Open colorzpe opened 1 year ago

colorzpe commented 1 year ago

Is there an existing issue for this?

Is your issue described in the documentation?

Is your issue present in the nightly release?

Describe the Bug

Sound cracking / stutter on Streaming Speaker happen with default sound format (16bit 48khz)

can be solve by change format to 16 bit 44.1khz but need to apply every time when start sunshine

Expected Behavior

can i change default format ?

Additional Context

No response

Host Operating System

Windows

Operating System Version

10 21H2

Architecture

64 bit

Sunshine commit or version

0.20.0

Package

Windows - portable

GPU Type

AMD

GPU Model

rx 6600xt

GPU Driver/Mesa Version

22.11.2

Capture Method (Linux Only)

No response

Config

channels = 1
port = 47989
upnp = enabled
resolutions = [
    352x240,
    480x360,
    858x480,
    1280x720,
    1920x1080
]
fec_percentage = 20
hevc_mode = 1
fps = [10,30,60]
min_threads = 2
amd_quality = speed

Apps

Diablo 4

Relevant log output

[2023:06:23:11:53:00]: Info: Sunshine version: 0.20.0
[2023:06:23:11:53:00]: Info: Compiling shaders...
[2023:06:23:11:53:00]: Info: System tray created
[2023:06:23:11:53:00]: Info: Compiled shaders
[2023:06:23:11:53:00]: Info: Successfully reset default audio device
[2023:06:23:11:53:00]: Info: // Testing for available encoders, this may generate errors. You can safely ignore those errors. //
[2023:06:23:11:53:00]: Info: Trying encoder [nvenc]
[2023:06:23:11:53:00]: Error: Failed to sync desktop to thread [0x000000AA]
[2023:06:23:11:53:00]: Info: ddprobe.exe [1] [] returned: 0x00000000
[2023:06:23:11:53:00]: Info: Set GPU preference: 1
[2023:06:23:11:53:00]: Info: 
Device Description : AMD Radeon RX 6650 XT Series
Device Vendor ID   : 0x00001002
Device Device ID   : 0x000073FF
Device Video Mem   : 8147 MiB
Device Sys Mem     : 0 MiB
Share Sys Mem      : 8158 MiB
Feature Level      : 0x0000B100
Capture size       : 1920x1080
Offset             : 0x0
Virtual Desktop    : 1920x1080
[2023:06:23:11:53:00]: Info: Desktop resolution [1920x1080]
[2023:06:23:11:53:00]: Info: Desktop format [DXGI_FORMAT_B8G8R8A8_UNORM]
[2023:06:23:11:53:00]: Info: 
Colorspace         : DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P709
Bits Per Color     : 10
Red Primary        : [0.646484,0.330078]
Green Primary      : [0.30957,0.617188]
Blue Primary       : [0.152344,0.0732422]
White Point        : [0.313477,0.329102]
Min Luminance      : 0.01 nits
Max Luminance      : 1499 nits
Max Full Luminance : 799 nits
[2023:06:23:11:53:00]: Info: SDR color coding [Rec. 601]
[2023:06:23:11:53:00]: Info: Color range: [JPEG]
[2023:06:23:11:53:00]: Error: Could not open codec [h264_nvenc]: Operation not permitted
[2023:06:23:11:53:00]: Error: Failed to sync desktop to thread [0x000000AA]
[2023:06:23:11:53:00]: Info: 
Device Description : AMD Radeon RX 6650 XT Series
Device Vendor ID   : 0x00001002
Device Device ID   : 0x000073FF
Device Video Mem   : 8147 MiB
Device Sys Mem     : 0 MiB
Share Sys Mem      : 8158 MiB
Feature Level      : 0x0000B100
Capture size       : 1920x1080
Offset             : 0x0
Virtual Desktop    : 1920x1080
[2023:06:23:11:53:00]: Info: Desktop resolution [1920x1080]
[2023:06:23:11:53:00]: Info: Desktop format [DXGI_FORMAT_B8G8R8A8_UNORM]
[2023:06:23:11:53:00]: Info: 
Colorspace         : DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P709
Bits Per Color     : 10
Red Primary        : [0.646484,0.330078]
Green Primary      : [0.30957,0.617188]
Blue Primary       : [0.152344,0.0732422]
White Point        : [0.313477,0.329102]
Min Luminance      : 0.01 nits
Max Luminance      : 1499 nits
Max Full Luminance : 799 nits
[2023:06:23:11:53:00]: Info: SDR color coding [Rec. 601]
[2023:06:23:11:53:00]: Info: Color range: [JPEG]
[2023:06:23:11:53:00]: Error: Could not open codec [h264_nvenc]: Operation not permitted
[2023:06:23:11:53:00]: Error: Failed to sync desktop to thread [0x000000AA]
[2023:06:23:11:53:00]: Info: 
Device Description : AMD Radeon RX 6650 XT Series
Device Vendor ID   : 0x00001002
Device Device ID   : 0x000073FF
Device Video Mem   : 8147 MiB
Device Sys Mem     : 0 MiB
Share Sys Mem      : 8158 MiB
Feature Level      : 0x0000B100
Capture size       : 1920x1080
Offset             : 0x0
Virtual Desktop    : 1920x1080
[2023:06:23:11:53:00]: Info: Desktop resolution [1920x1080]
[2023:06:23:11:53:00]: Info: Desktop format [DXGI_FORMAT_B8G8R8A8_UNORM]
[2023:06:23:11:53:00]: Info: 
Colorspace         : DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P709
Bits Per Color     : 10
Red Primary        : [0.646484,0.330078]
Green Primary      : [0.30957,0.617188]
Blue Primary       : [0.152344,0.0732422]
White Point        : [0.313477,0.329102]
Min Luminance      : 0.01 nits
Max Luminance      : 1499 nits
Max Full Luminance : 799 nits
[2023:06:23:11:53:00]: Info: SDR color coding [Rec. 601]
[2023:06:23:11:53:00]: Info: Color range: [JPEG]
[2023:06:23:11:53:00]: Error: Could not open codec [h264_nvenc]: Operation not permitted
[2023:06:23:11:53:00]: Error: Failed to sync desktop to thread [0x000000AA]
[2023:06:23:11:53:00]: Info: 
Device Description : AMD Radeon RX 6650 XT Series
Device Vendor ID   : 0x00001002
Device Device ID   : 0x000073FF
Device Video Mem   : 8147 MiB
Device Sys Mem     : 0 MiB
Share Sys Mem      : 8158 MiB
Feature Level      : 0x0000B100
Capture size       : 1920x1080
Offset             : 0x0
Virtual Desktop    : 1920x1080
[2023:06:23:11:53:00]: Info: Desktop resolution [1920x1080]
[2023:06:23:11:53:00]: Info: Desktop format [DXGI_FORMAT_B8G8R8A8_UNORM]
[2023:06:23:11:53:00]: Info: 
Colorspace         : DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P709
Bits Per Color     : 10
Red Primary        : [0.646484,0.330078]
Green Primary      : [0.30957,0.617188]
Blue Primary       : [0.152344,0.0732422]
White Point        : [0.313477,0.329102]
Min Luminance      : 0.01 nits
Max Luminance      : 1499 nits
Max Full Luminance : 799 nits
[2023:06:23:11:53:00]: Info: SDR color coding [Rec. 601]
[2023:06:23:11:53:00]: Info: Color range: [JPEG]
[2023:06:23:11:53:00]: Error: Could not open codec [h264_nvenc]: Operation not permitted
[2023:06:23:11:53:00]: Info: Encoder [nvenc] failed
[2023:06:23:11:53:00]: Info: Trying encoder [quicksync]
[2023:06:23:11:53:00]: Error: Failed to sync desktop to thread [0x000000AA]
[2023:06:23:11:53:00]: Info: 
Device Description : AMD Radeon RX 6650 XT Series
Device Vendor ID   : 0x00001002
Device Device ID   : 0x000073FF
Device Video Mem   : 8147 MiB
Device Sys Mem     : 0 MiB
Share Sys Mem      : 8158 MiB
Feature Level      : 0x0000B100
Capture size       : 1920x1080
Offset             : 0x0
Virtual Desktop    : 1920x1080
[2023:06:23:11:53:00]: Info: Desktop resolution [1920x1080]
[2023:06:23:11:53:00]: Info: Desktop format [DXGI_FORMAT_B8G8R8A8_UNORM]
[2023:06:23:11:53:00]: Info: 
Colorspace         : DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P709
Bits Per Color     : 10
Red Primary        : [0.646484,0.330078]
Green Primary      : [0.30957,0.617188]
Blue Primary       : [0.152344,0.0732422]
White Point        : [0.313477,0.329102]
Min Luminance      : 0.01 nits
Max Luminance      : 1499 nits
Max Full Luminance : 799 nits
[2023:06:23:11:53:00]: Info: SDR color coding [Rec. 601]
[2023:06:23:11:53:00]: Info: Color range: [JPEG]
[2023:06:23:11:53:00]: Error: Failed to derive device context: Unknown error occurred
[2023:06:23:11:53:00]: Error: Failed to sync desktop to thread [0x000000AA]
[2023:06:23:11:53:00]: Info: 
Device Description : AMD Radeon RX 6650 XT Series
Device Vendor ID   : 0x00001002
Device Device ID   : 0x000073FF
Device Video Mem   : 8147 MiB
Device Sys Mem     : 0 MiB
Share Sys Mem      : 8158 MiB
Feature Level      : 0x0000B100
Capture size       : 1920x1080
Offset             : 0x0
Virtual Desktop    : 1920x1080
[2023:06:23:11:53:00]: Info: Desktop resolution [1920x1080]
[2023:06:23:11:53:00]: Info: Desktop format [DXGI_FORMAT_B8G8R8A8_UNORM]
[2023:06:23:11:53:00]: Info: 
Colorspace         : DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P709
Bits Per Color     : 10
Red Primary        : [0.646484,0.330078]
Green Primary      : [0.30957,0.617188]
Blue Primary       : [0.152344,0.0732422]
White Point        : [0.313477,0.329102]
Min Luminance      : 0.01 nits
Max Luminance      : 1499 nits
Max Full Luminance : 799 nits
[2023:06:23:11:53:00]: Info: SDR color coding [Rec. 601]
[2023:06:23:11:53:00]: Info: Color range: [JPEG]
[2023:06:23:11:53:00]: Error: Failed to derive device context: Unknown error occurred
[2023:06:23:11:53:00]: Error: Failed to sync desktop to thread [0x000000AA]
[2023:06:23:11:53:01]: Info: 
Device Description : AMD Radeon RX 6650 XT Series
Device Vendor ID   : 0x00001002
Device Device ID   : 0x000073FF
Device Video Mem   : 8147 MiB
Device Sys Mem     : 0 MiB
Share Sys Mem      : 8158 MiB
Feature Level      : 0x0000B100
Capture size       : 1920x1080
Offset             : 0x0
Virtual Desktop    : 1920x1080
[2023:06:23:11:53:01]: Info: Desktop resolution [1920x1080]
[2023:06:23:11:53:01]: Info: Desktop format [DXGI_FORMAT_B8G8R8A8_UNORM]
[2023:06:23:11:53:01]: Info: 
Colorspace         : DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P709
Bits Per Color     : 10
Red Primary        : [0.646484,0.330078]
Green Primary      : [0.30957,0.617188]
Blue Primary       : [0.152344,0.0732422]
White Point        : [0.313477,0.329102]
Min Luminance      : 0.01 nits
Max Luminance      : 1499 nits
Max Full Luminance : 799 nits
[2023:06:23:11:53:01]: Info: SDR color coding [Rec. 601]
[2023:06:23:11:53:01]: Info: Color range: [JPEG]
[2023:06:23:11:53:01]: Error: Failed to derive device context: Unknown error occurred
[2023:06:23:11:53:01]: Error: Failed to sync desktop to thread [0x000000AA]
[2023:06:23:11:53:01]: Info: 
Device Description : AMD Radeon RX 6650 XT Series
Device Vendor ID   : 0x00001002
Device Device ID   : 0x000073FF
Device Video Mem   : 8147 MiB
Device Sys Mem     : 0 MiB
Share Sys Mem      : 8158 MiB
Feature Level      : 0x0000B100
Capture size       : 1920x1080
Offset             : 0x0
Virtual Desktop    : 1920x1080
[2023:06:23:11:53:01]: Info: Desktop resolution [1920x1080]
[2023:06:23:11:53:01]: Info: Desktop format [DXGI_FORMAT_B8G8R8A8_UNORM]
[2023:06:23:11:53:01]: Info: 
Colorspace         : DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P709
Bits Per Color     : 10
Red Primary        : [0.646484,0.330078]
Green Primary      : [0.30957,0.617188]
Blue Primary       : [0.152344,0.0732422]
White Point        : [0.313477,0.329102]
Min Luminance      : 0.01 nits
Max Luminance      : 1499 nits
Max Full Luminance : 799 nits
[2023:06:23:11:53:01]: Info: SDR color coding [Rec. 601]
[2023:06:23:11:53:01]: Info: Color range: [JPEG]
[2023:06:23:11:53:01]: Error: Failed to derive device context: Unknown error occurred
[2023:06:23:11:53:01]: Info: Encoder [quicksync] failed
[2023:06:23:11:53:01]: Info: Trying encoder [amdvce]
[2023:06:23:11:53:01]: Error: Failed to sync desktop to thread [0x000000AA]
[2023:06:23:11:53:01]: Info: 
Device Description : AMD Radeon RX 6650 XT Series
Device Vendor ID   : 0x00001002
Device Device ID   : 0x000073FF
Device Video Mem   : 8147 MiB
Device Sys Mem     : 0 MiB
Share Sys Mem      : 8158 MiB
Feature Level      : 0x0000B100
Capture size       : 1920x1080
Offset             : 0x0
Virtual Desktop    : 1920x1080
[2023:06:23:11:53:01]: Info: Desktop resolution [1920x1080]
[2023:06:23:11:53:01]: Info: Desktop format [DXGI_FORMAT_B8G8R8A8_UNORM]
[2023:06:23:11:53:01]: Info: 
Colorspace         : DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P709
Bits Per Color     : 10
Red Primary        : [0.646484,0.330078]
Green Primary      : [0.30957,0.617188]
Blue Primary       : [0.152344,0.0732422]
White Point        : [0.313477,0.329102]
Min Luminance      : 0.01 nits
Max Luminance      : 1499 nits
Max Full Luminance : 799 nits
[2023:06:23:11:53:01]: Info: SDR color coding [Rec. 601]
[2023:06:23:11:53:01]: Info: Color range: [JPEG]
[2023:06:23:11:53:01]: Info: 
[2023:06:23:11:53:01]: Info: // Ignore any errors mentioned above, they are not relevant. //
[2023:06:23:11:53:01]: Info: 
[2023:06:23:11:53:01]: Info: Found encoder amdvce: [h264_amf]
[2023:06:23:11:53:01]: Info: Configuration UI available at [https://localhost:47990]
[2023:06:23:11:53:02]: Info: Registered Sunshine mDNS service
[2023:06:23:11:53:03]: Info: Completed UPnP port mappings to 192.168.88.38 via http://192.168.88.1:33944/rootDesc.xml
AlbertBS45 commented 1 year ago

I am also suffering this issue. With a fresh installation everything worked ok, but after some time the crackling began and uninstalling/installing again (v0.20) didn't solve anything.

The crackling audio still persists after changing the format to 16 or 24 bit 44.1khz.

I also tried different versions of Moonlight with no results.

Only thing that worked for me is downgrading to v0.19.1

BatJoe commented 1 year ago

I can confirm I have noticed this issue as well

huoyan1231 commented 1 year ago

same here how to change the format to 44.1khz?

BatJoe commented 1 year ago

https://github.com/LizardByte/Sunshine/discussions/1471

xCISACx commented 1 year ago

I have this issue too and downgrading did not help. I tried changing the format to 44.1 KHz and the audio stopped working until I restarted Sunshine. After I did, it still crackles.

snicmtl commented 1 year ago

Same issue on 0.2. Two Win10 machines on wired gigabit ethernet. Crackling in games and general streaming

JamTarty commented 1 year ago

Same issue for me too, I thought it was just user error at first. Wired connection, Win10 Cracking audio, when I switch to my wireless headset instead of the Steam streaming speakers the crackling goes away completely.

I've only tested this on my SteamDeck, but I assume it's the same on other devices based on the above.

LizardByte-bot commented 11 months ago

It seems this issue hasn't had any activity in the past 90 days. If it's still something you'd like addressed, please let us know by leaving a comment. Otherwise, to help keep our backlog tidy, we'll be closing this issue in 10 days. Thanks!

alchist commented 11 months ago

I have same issue, tried to change audio quality, but no luck. Audio crackles once or twice a minute

1PercentSync commented 10 months ago

try latest nightly, mine works fine when switched to nightly

LizardByte-bot commented 7 months ago

It seems this issue hasn't had any activity in the past 90 days. If it's still something you'd like addressed, please let us know by leaving a comment. Otherwise, to help keep our backlog tidy, we'll be closing this issue in 10 days. Thanks!

Anvil5465 commented 7 months ago

This is a persistent issue for me

giejay commented 7 months ago

Someone recommended to change the wifi 5ghz channel to 44. That worked for me, I would say, give it a shot. This is his the video I'm using as a test: https://m.youtube.com/watch?v=WO2b03Zdu4Q

Anvil5465 commented 7 months ago

Unfortunately, I have tried with both ethernet and wifi, so I don't think that is the issue for me

snicmtl commented 7 months ago

Has not been an issue for me in a while, win10 host client and wired

On Mon, Apr 8, 2024 at 14:15 GJ Compagner @.***> wrote:

Someone recommended to change the wifi 5ghz channel to 44. That worked for me, I would say, give it a shot. This is his the video I'm using as a test: https://m.youtube.com/watch?v=WO2b03Zdu4Q

— Reply to this email directly, view it on GitHub https://github.com/LizardByte/Sunshine/issues/1389#issuecomment-2043389743, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGIRUXCEPRRHJKPDYLD6EK3Y4LNFRAVCNFSM6AAAAAAZRCT5MGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANBTGM4DSNZUGM . You are receiving this because you commented.Message ID: @.***>

f1yn commented 7 months ago

I know this is probably a stretch, but wanted to chime in as well. This is just a working theory at the moment:

Short: Try disconnecting your client device from said network for a minute (enough for a DHCP lease to revalidate, but at least long enough for said router to not think it's just a dropped connection). Then reconnect to said network. If that doesn't work, check if your router has any sort of QoS settings and maybe make sure that the packets to your remote client aren't getting needlessly deprioritized. For me, disconnecting and reconnecting a device from the network fixes all audio issues.

Longer:

A while ago, I was having some issues with my AMD card (7800 XT), and it ended up being an issue with the PCI slot. Moving it to a different slot seemed to clear up the choppy audio I was having over HDMI.

I've been using the Android client of Moonlight for some time, and recently I've noticed that after a few days, a specific device (but no other devices) would start to have choppy audio. There would be no error messages in Moonlight, or in Sunshine, but I'd get weird choppy audio that sounded more like the aforementioned AMD driver failure.

I tried all the other fixes, swapping Audio drivers, making sure I'm using a different bitrate for said driver. Manually overriding things. No changes, but still choppy audio. I also did a few hard reboots to rule out a driver state issue (which seems to be an AMD thing).

But then I took a chance. As far as I remember, higher bitrate medium going over any network uses UDP for the most part. UDP is a rapid fire protocol, it's up to the packets to figure out how to ensure "ordering" and when you're on a network that has more than one thing going on (swapping from wired to wireless, for example) there's a chance that those packets don't make it. That's where the term dropped packets comes from.

When I disconnected my Android client from the network for a minute, and reconnected to the existing Sunshine instance, there were no more choppy audio issues.

Why? Well, I think my ISP router was deprioritizing packets from the Sunshine host to the client. In more advanced routers (i.e not an ISP one), this is called QoS, and it makes sure certain types of traffic (usually from specific hosts) gets processed before any other traffic.

What seemed to be happening is that, the longer a client device is attached to the network, the more likely the router was to start lowering it's importance in terms of higher spread packet delivery. For TCP protocols (for which is used for the majority of non streaming web traffic), that's not usually an issue because it has a bunch of redundancies to make sure that retries can happen and that data can be validated in order. This isn't the case for UDP though, which is likely why the effects are so noticable and so jarring. Video data can sometimes work around this by stalling frames, but audio isn't so lucky. For codecs and implementations that attempt real time transfer, you're gonna get wicked clicks and audio artifacts due to it not being able to rely on past audio data the same way visual data can.

I need to emphasize though that this was entirely the fault of my router, so this might not be the cause of you already have a router that's not doing this. The catch is that I wasn't able to tell until I noticed an immediate change in result after reconnecting the client to the network.

This is just a hunch, but is honestly why this issue is so funky and hard to reliably reproduce.

Nitrousoxide commented 5 months ago

I am also still encountering this issue on my local network where latency and bandwidth should largely not be an issue. Jumping over to my host pc I don't hear the crackling through the speakers when it's streaming, just in the client devices.

beckman924 commented 4 months ago

I´m having this issue too. Is there any fix?

Nikiroy78 commented 3 months ago

Distribution: kubuntu 22.04 I do not know how I fixed the problem for myself, since I also had a crackling sound from the start, but after the following manipulations, I still solved this problem. I used the following command:

rm -f ~/.config/pulse/*
sudo killall pulseaudio
# daemon(s) will restart imediately

After that, either the sound device settings were reset, or it switched to working, but the sound crackled less at first, and then became completely clear. If it helped someone or not, please unsubscribe here about the results.

eebssk1 commented 3 months ago

There are definitly some problems in Streaming Speaker driver. I'm testing under local lan and the fix does not work. After uninstalling the valve Streaming Speaker driver, sound become normal as usual. I'm using v2024.809.202917

beckman924 commented 3 months ago

There are definitly some problems in Streaming Speaker driver. I'm testing under local lan and the fix does not work. After uninstalling the valve Streaming Speaker driver, sound become normal as usual. I'm using v2024.809.202917

What speaker are you using if you uninstall the Steam Streaming Speaker?

eebssk1 commented 3 months ago

There are definitly some problems in Streaming Speaker driver. I'm testing under local lan and the fix does not work. After uninstalling the valve Streaming Speaker driver, sound become normal as usual. I'm using v2024.809.202917

What speaker are you using if you uninstall the Steam Streaming Speaker?

i don't know.. I just uninstalled the valve SSS driver and let sunshine run without it. I'm not running as admin so it won't reinstall the driver.

ReenigneArcher commented 3 months ago

Depending on the your sunshine config, Sunshine will just re-install it again.

eebssk1 commented 3 months ago

Depending on the your sunshine config, Sunshine will just re-install it again.

I checked in device manager, it's not installed.

And yes I can hear the sound from the computer(and sometimes scares my dog)

zoobporsor commented 1 month ago

I have sound crackling with Arch Linux host and a laptop 5ghz wifi client. Every minute or so is a loud crack and pop on the client side. the host is using the Pacman repo sunshine-git as its the only version of the program I can successfully get working