Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Audio stutter on win11 due to broken Directsound #20567

Closed
2 of 7 tasks
moetayuko opened this issue Nov 23, 2021 · 29 comments · Fixed by #25046
Closed
2 of 7 tasks

Audio stutter on win11 due to broken Directsound #20567

moetayuko opened this issue Nov 23, 2021 · 29 comments · Fixed by #25046
Labels
Component: Audio Platform: Windows Resolution: Fixed issue was resolved by a code change Triage: Has proposed fix Issue has been reproduced and has a pending proposed fix v20 Nexus v21 Omega v22 Piers

Comments

@moetayuko
Copy link
Contributor

Bug report

Describe the bug

After moving from win10 to win11, I can no longer enjoy videos on kodi. Audio stutters all the way including UI sound. A workaround I found is switching the audio backend to WASAPI, where Directsound, the default choice, seems to be broken. Both the UWP version from M$ store and the .exe installer suffer from the same problem.

Expected Behavior

Audio plays normally.

Actual Behavior

Both UI sound and video sound stutter all the way.

Possible Fix

No idea.

To Reproduce

Steps to reproduce the behavior:

  1. Fresh install Kodi 19.3 on a win11 machine.
  2. Play a random video or use arrow keys to browse the menus to trigger UI sound.

Debuglog

The debuglog can be found here, which is full of:

WARNING <general>: CWin32DirectSound::GetSpace - buffer underrun - W:16248, P:4294965000, O:384.

Full log: https://fars.ee/nYT6.log (captured from a fresh UWP install)

Your Environment

Used Operating system:

  • Android

  • iOS

  • tvOS

  • Linux

  • OSX

  • Windows

  • Windows UWP

  • Operating system version/name: Windows 11 Home 21H2 22000.348

  • Device: Surface Pro 7

  • Kodi version: 19.3

note: Once the issue is made we require you to update it with new information or Kodi versions should that be required.
Team Kodi will consider your problem report however, we will not make any promises the problem will be solved.

@thexai
Copy link
Member

thexai commented Nov 25, 2021

Tested on Intel NUC8i3BEK + Windows 11 + DirectSound and I can not reproduce.

@thexai thexai added the Triage: Tested and not reproduced Effort has been placed into testing the issue but no one has been able to reproduce it yet label Nov 25, 2021
@moetayuko
Copy link
Contributor Author

Could this be a hardware-specific issue? However, Kodi is the only broken app I observed so far. My win11 is clean installed via official iso downloaded from MS website and all drivers are automatically installed via windows update, so it can't be an issue due to improper OS configuration.

@thexai
Copy link
Member

thexai commented Nov 25, 2021

Try set default audio device to "Speakers - 扬声器 (2- Realtek High Definition Audio(SST))"

Maybe only occurs with "Headphones - 耳机 (EDIFIER TWS1 Pro)"

Anyway log posted is no debug log...

@moetayuko
Copy link
Contributor Author

Try set default audio device to "Speakers - 扬声器 (2- Realtek High Definition Audio(SST))"

Maybe only occurs with "Headphones - 耳机 (EDIFIER TWS1 Pro)"

Wow exactly, Directsound works well with the speaker. It's problematic with my BT headset. Unpairing and re-pairing didn't help. What else should I provide to assist in diagnosing?

@thexai
Copy link
Member

thexai commented Nov 25, 2021

Is not Kodi bug. Is specific hardware/driver issue. I am going to close this as github issues is not for support.

Please use forum (https://forum.kodi.tv/forumdisplay.php?fid=59) for support.

@thexai thexai closed this as completed Nov 25, 2021
@thexai
Copy link
Member

thexai commented Nov 25, 2021

Windows 11 update KB5007262 may fix this issue.

November 22, 2021—KB5007262 (OS Build 22000.348) Preview

Updates volume control issues that affect Bluetooth audio devices.

Addresses an issue in the Windows audio system that might cause the audiodg.exe process to stop working, which results in a temporary loss of audio.

https://support.microsoft.com/en-us/topic/november-22-2021-kb5007262-os-build-22000-348-preview-7f3e18d7-4189-4882-b0e9-afc920253aee

@thexai thexai added the Resolution: Not applicable issue is not relevant to code in this repo and is not an external issue label Nov 25, 2021
@moetayuko
Copy link
Contributor Author

Mine is already 22000.348, but pretty sure the issue persists before and after this update.

@richardsampson
Copy link

I also have this issue on a desktop running Windows 11 (version 22000.593) with Kodi 19.4 and using Sony WH-1000XM3 bluetooth headphones. Switching from DirectSound to WASAPI in Kodi does seem to fix it. The exact same configuration with DirectSound works fine on Windows 10 so it definitely seems to be a Windows 11 problem.

@antiphon0
Copy link

antiphon0 commented Sep 18, 2022

can confirm this happens on Win 11, also using bluetooth headphones.

edit: got it to work a lot better - you have to set the Audio setting from "best match" to "fixed" - I also swapped it to 2.1 audio. There's some occasional blips, but it's significantly improved, whereas before the video became completely unwatchable after 30 seconds or so. It's by no means perfect, though.

@rampagejoe
Copy link

problem still persists

I don't understand why it's closed

Kodi is the culprit obviously

@Henrique-Tadeu
Copy link

Same problem here with BT headphone (Soundcore Q30) on Win11. Win10 worked perfeclty, but win11 only works with WASAPI. Any fix? I really need directsound to work as i'm wanting to use with 'dolby atmos for headphones'.

@boardlord1
Copy link

Suffering the same with any BT sound devices and Kodi, only option is using WASAPI. But, as the previous comment states, that means no Dolby Atmos for Headphones... Windows 10 worked perfectly.

@webitube
Copy link

webitube commented Dec 9, 2023

I'm using Kodi 20.2 with a Sony WH-1000XM4 with a bluetooth connection on Windows 11 and have the same stutter issue.
I've had to set to wasapi and Fixed 5.1 before it would not stutter.
As a bonus, Dolby Atmos for Headphones works fine with this setup.

@moetayuko
Copy link
Contributor Author

@thexai please reopen this issue. It's confirmed by different people and happening on various hardware.

@webitube
Copy link

webitube commented Dec 22, 2023

I've found a strange workaround which has worked reliably so far. I call it "priming the pump."

  • Start with Kodi closed.
  • Play a (same or different) video in a different program for about one minute. (I was using mpc-hc.)
  • Then, play the original video in Kodi. No stuttering. Plays fine for all videos in Kodi after this point.
  • The problem returns after closing and restarting Kodi.
  • Maybe this is an initialization bug?
  • Note: This occurs with my Sony 1000XM4 but not with my 1000XM3 using the same bluetooth adapter.

@denny099
Copy link

I'm using Kodi 20.2 with a Sony WH-1000XM4 with a bluetooth connection on Windows 11 and have the same stutter issue as well.

@FrankYu2018
Copy link

Solution

To use WASAPI (Windows Audio Session API) instead of DirectSound in Kodi, you'll need to adjust the audio settings within Kodi. Here's how you can do it:

  1. Open Kodi: Launch Kodi on your system.

  2. Navigate to Settings: Go to the Kodi settings menu. You can usually find this by clicking on the gear icon in the Kodi home screen.

  3. Go to System Settings: Depending on your version of Kodi, you may need to select "System" or "System Settings" from the settings menu.

  4. Select Audio Settings: Within the System Settings menu, look for an option related to audio or sound settings. It might be labeled as "Audio" or "Audio Settings."

  5. Choose Audio Output Device: Look for an option to select the audio output device. This is where you can choose between different audio APIs, including DirectSound and WASAPI.

  6. Select WASAPI: If WASAPI is available as an option, choose it from the list of available audio output devices. It may be listed as "WASAPI" or "Windows Audio Session API."

  7. Save Settings: Once you've selected WASAPI as the audio output device, make sure to save your settings. This might involve clicking on a "Save" or "Apply" button within the Kodi settings menu.

  8. Restart Kodi: After saving your audio settings, it's a good idea to restart Kodi to ensure that the changes take effect.

By following these steps, you should be able to switch Kodi's audio output from DirectSound to WASAPI. Keep in mind that the availability of WASAPI as an option may depend on your system configuration and the version of Kodi you're using.

@kbjunky
Copy link

kbjunky commented Feb 23, 2024

You have to uninstall Realtek Audio Console if you happen to have it.

@attmayMB
Copy link

This issue persists. It does not occur with every Bluetooth device, but it occurs with many. I have also tried it on multiple PCs. I posted a forum post about this behavior and everything I've tried to resolve it. The reason WASAPI won't work for me is the "TempoUp" option I use when watching certain content (it is garbled and crackly with WASAPI). I do believe this is something Kodi should be able to address even if the developers do not believe Kodi is to blame.

I also discovered the workaround described above as 'priming the pump' and it does work for me, but it's not a solution: #20567 (comment)

My forum post: https://forum.kodi.tv/showthread.php?tid=376406

@thexai thexai reopened this Apr 22, 2024
@thexai thexai added Platform: Windows Component: Audio Triage: Has proposed fix Issue has been reproduced and has a pending proposed fix v20 Nexus v21 Omega and removed Resolution: Not applicable issue is not relevant to code in this repo and is not an external issue Triage: Tested and not reproduced Effort has been placed into testing the issue but no one has been able to reproduce it yet labels Apr 22, 2024
@WyattGorman
Copy link

Came here to say I'm having this exact problem. WASAPI is the only audio output that doesn't stutter, but it doesn't then work when other audio is playing.

@thexai
Copy link
Member

thexai commented Jun 21, 2024

Issue is fixed and fix is included in v22 nightlies:

https://mirrors.kodi.tv/nightlies/windows/win64/master/

@brupec
Copy link

brupec commented Jul 6, 2024

Hi all, tested on latest 22 nightly, sounds now outputs constantly but lot of glitch/pops (not sure how to say it) but to make it simple, quality of sound is bad 😢

@fritsch
Copy link
Member

fritsch commented Jul 7, 2024

Can you post a log, please? I suspect this is underruns (due to buffer / period configuration) ... let's see.

@brupec
Copy link

brupec commented Jul 7, 2024 via email

@fritsch
Copy link
Member

fritsch commented Jul 7, 2024

The attachment, did not make it. Please reply on github and post a link to a paste.kodi.tv url.

@brupec
Copy link

brupec commented Jul 7, 2024

oups sorry, seems it didn't go via email. here it is
kodi.old.log

@brupec
Copy link

brupec commented Jul 7, 2024

@thexai
Copy link
Member

thexai commented Jul 20, 2024

@brupec
Copy link

brupec commented Jul 21, 2024

@brupec

Can you test this new build: https://forum.kodi.tv/showthread.php?tid=376406&pid=3204473#pid3204473

Hi

Works perfect for me :-)

Thanks a lot for the fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Audio Platform: Windows Resolution: Fixed issue was resolved by a code change Triage: Has proposed fix Issue has been reproduced and has a pending proposed fix v20 Nexus v21 Omega v22 Piers
Projects
None yet
Development

Successfully merging a pull request may close this issue.