You are not logged in.

#1 2024-04-02 06:06:34

joca
Member
Registered: 2024-04-01
Posts: 4

Audio weirdness in KDE

I am trying out Plasma6 and have noticed something interesting that I'm not sure is directly related to to plasma or not.  i run about 3-4 vm's at a time.  2 of them are archlinux vm's, 1 ubuntu, 1 freebsd and all running on a archlinux host.  The sound card is connected to all of them on startup.  Each vm I have alsa configured and audio is working as confirmed by running speaker-test -c2 in each vm.  Audio is working on my host desktop also confirmed via speaker-test -c2 and by using the KDE system settings utility->sound->test right and left.  All no issues.

On the archlinux vm's if I go to invidious and watch a video then the sound via KDE system settings reports Error, invalid state, but sound does work, when testing via alsa with speaker-test.  On the ubuntu vm I do not have this issue.  If I disconnect the sound card from the archlinux vm I was just watching a video in then kde system settings shows the card is working again.  I am perplexed what the difference is in audio configuration between alsa and KDE.  Why does speaker-test continue to work but kde system settings is reporting the sound card is in an invalid state?  and why does it only happen after watching a video in a browser?

Offline

#2 2024-04-02 08:45:20

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 21,764

Re: Audio weirdness in KDE

Generally speaking ALSA allows only one single process accessing the audio card at the same time.

On a "normal desktop" you usually use pipewire or pulseaudio to mix together all the different applications that might want to use the sound card so that only a single final process accesses the sound card. Depending on how your VMs are configured, you are actually making the connect directly to the sound card, taking away the sound card from other processes. Make sure that your VM software connects to the audio card via some pulseaudio/pipewire layer if possible -- and you do not directly pass the raw audio device.

To properly check post/check

sudo fuser -v /dev/snd/*

from the host during the "normal" usage and again when watching video in a browser in your VM

Last edited by V1del (2024-04-02 08:47:24)

Offline

#3 2024-04-02 18:41:33

joca
Member
Registered: 2024-04-01
Posts: 4

Re: Audio weirdness in KDE

In a good state i see the following

                     USER        PID ACCESS COMMAND
/dev/snd/controlC1:  joca       1982 F.... pulseaudio
/dev/snd/controlC2:  joca       1982 F.... pulseaudio
/dev/snd/controlC3:  joca       1982 F.... pulseaudio

when the sound device is locked i see:

                     USER        PID ACCESS COMMAND
/dev/snd/controlC0:  joca      13667 F.... vmware-vmx
/dev/snd/controlC1:  joca       1982 F.... pulseaudio
/dev/snd/controlC2:  joca       1982 F.... pulseaudio
/dev/snd/controlC3:  joca       1982 F.... pulseaudio
/dev/snd/pcmC3D0p:   joca      13667 F...m vmware-vmx
/dev/snd/timer:      joca      13667 f.... vmware-vmx

One of the interesting things I've noticed, is in the vm, if I am on a video page in the browser such as invidious and watching or pausing a video then vmware-vmx has the sound device locked as observed above.  If I close that page, then the audio device is unlock as seen in the first block above.

I do expect the audio to be locked if its being played but not if its paused.  Also I'm still not understanding why in both VM and host i can use speaker-test to play audio simultaneously but not pulseaudio via pacat.

Last edited by joca (2024-04-02 20:23:21)

Offline

#4 2024-04-02 22:05:25

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 21,764

Re: Audio weirdness in KDE

Whether the audio is locked or not during "pause" is up to your browsers specific media handling implementation and not something you'll generally have control over.

I'd strongly suggest you configure your VM software to use pulseaudio directly if possible, or install pulseaudio-alsa and pass the "default" device to the VM so everything gets mixed over pulseaudio.

Offline

Board footer

Powered by FluxBB