easyeffects icon indicating copy to clipboard operation
easyeffects copied to clipboard

easyeffects consumes 3-5 % fo CPU even if mic is not used

Open promeneur opened this issue 2 years ago • 38 comments

EasyEffects Version

6.2.6

What package are you using?

openSUSE

Distribution

openSUSE Tumbleweed

Describe the bug

I set easyeffects according to cancel noise for the mic. I check that easyeffects consumes 3-5 % CPU when I don't use the mic.

Furthermore, I was thinking that easyeffetcs is in some sort of sleep mode when we don't use the mic.

Noisetorch doesn't use any % CPU when the mic is not used.

Expected Behavior

easyeefects doesn't use any % CPU when the mic is not used.

Debug Log

Debug Log
Paste your log here

Additional Information

No response

promeneur avatar Jul 29 '22 09:07 promeneur

I can't reproduce this issue. When nothing is recording from our virtual source our pipeline is unlinked and as a result no processing is done. What may be happening to you is that third party tools as Pavucontrol or anything else that can be attaching level meters to our virtual source are forcing our pipeline to stay active.

This happens because at the end of the day level meters links looks like any other link. So if you keep Pavucontrol or similar programs opened while easyeffects is running they will force our pipeline to stay linked.

wwmm avatar Jul 29 '22 13:07 wwmm

Something else to keep in mind is that EasyEffects has two pipelines. One for the mic and another for the speakers. Are you sure there is no activity on the speakers pipeline?

wwmm avatar Jul 29 '22 13:07 wwmm

What may be happening to you is that third party tools as Pavucontrol or anything else that can be attaching level meters to >> our virtual source are forcing our pipeline to stay active.

I don't use pavucontrol

promeneur avatar Jul 29 '22 13:07 promeneur

I don't use pavucontrol

Ok. But there is something besides your audio recording application linked to our virtual device? You can see this through Helvum or by running pw-dot. It's output file can be viewed with xdot.

Something else to have in mind is that there is an activity timeout we use in order to decide if we have to unlink the filters or not. You can customize it in our settings menu.

wwmm avatar Jul 29 '22 13:07 wwmm

I noticed this:

without easyeffects

if I speak, then I see the mic volume changing and the speakers volume stays at 0.

with easyeffects if i speak then i see the mic volume changing and the speakers volume changing.

Note: I disabled easyeffects for all outputs because I just want only noise cancelation for the mic.

promeneur avatar Jul 29 '22 13:07 promeneur

Ok. But there is something besides your audio recording application linked to our virtual device? You can see this through Helvum

I attached several captures of my settings. One of them is about helvum

promeneur avatar Jul 29 '22 13:07 promeneur

When measuring % CPU I don't use any app as Skype for example. then no app uses the mic

promeneur avatar Jul 29 '22 13:07 promeneur

I attached several captures of my settings. One of them is about helvum

I do not see any attached image in this issue. But I am on my phone at this moment. Maybe the mobile version of this site is hiding something.

wwmm avatar Jul 29 '22 14:07 wwmm

Sorry the attachments are here #1703

a new helvum view of pipewire

pipewire_helvum

promeneur avatar Jul 29 '22 14:07 promeneur

Sorry the attachments are here https://github.com/wwmm/easyeffects/issues/1703

Oh... Ok. Is that Plasma stream visible all the time? It will have the same effect as Pavucontrol. I thought I had already Blocklisted plasma. Is there any change if you add it's stream to the user Blocklist?

wwmm avatar Jul 29 '22 14:07 wwmm

you add it's stream to the user Blocklist?

How to ?

promeneur avatar Jul 29 '22 14:07 promeneur

I made an experiment.

I shut down a QEMU VM using mic and speakers of the host.

Result : easyeffects consumes 0 % CPU

Note: no app in the VM using mic and speakers is running.

promeneur avatar Jul 29 '22 14:07 promeneur

How to ?

At the side of the enable checkbox there is one called Exclude. Enable it.

But thinking about it again it does not seem it is going to be enough. I will have to find a way to deal with these level meter streams once and for all. Differently from Pavucontrol I do not think you can "just close" this one from plasma...

wwmm avatar Jul 29 '22 14:07 wwmm

I shut down a QEMU VM using mic and speakers of the host.

Oh... Só qemu has streams that are active all the time... This explains why our pipeline is always linked in your system. Try to enable the exclude checkbox in it's stream

wwmm avatar Jul 29 '22 14:07 wwmm

Another result of my experiment : in the easyeffects setting tool now I get an empty list for input and ouput players

promeneur avatar Jul 29 '22 14:07 promeneur

Another result of my experiment

pipewire_helvum_1

promeneur avatar Jul 29 '22 14:07 promeneur

I excluded the input and output of the QEMU VM.

Resutl: easyeffects consumes 0 % CPU.

But now there is no noise cancelation for any app running in the VM. No ?

promeneur avatar Jul 29 '22 14:07 promeneur

In plasma volume control, we can see that QEMU VM mic and speakers are disabled.

plasma_volume_control

promeneur avatar Jul 29 '22 15:07 promeneur

Can I conclude that easyeffects does not take care of this ?

Why for easyeffects they are enabled ?

In QEMU VM mic and speakers are enabled on demand. For example, if a notification happens in the VM or I use an app in the VM using the mic.

promeneur avatar Jul 29 '22 15:07 promeneur

In plasma volume control, we can see that QEMU VM mic and speakers are disabled.

Unfortunately what that Plasma window is telling is that these streams are muted. A muted stream can still have active links. And what easyeffects does in order to decide if our filters should stay linked is checking if there are active links linked to our virtual device. QEMU links are muted but probably still in the active state.

wwmm avatar Jul 29 '22 15:07 wwmm

Run pw-dump while the QEMU streams are muted and linked to easyeffects. It's output file should show in what state the QEMU links really are. I think I will have to add some kind of workaround for it. I am not sure what yet.

wwmm avatar Jul 29 '22 15:07 wwmm

pw-dump log

pw-dup.log

promeneur avatar Jul 29 '22 15:07 promeneur

pw-dup.log

In this file the node easyeffects_source has id = 37 and can be seen at the line 1210. The QEMU node has id = 128 and can be seen at the line 9019. The state of one of the links between these two nodes can be seen at the line 9879. As expected the link is in the active state. Thinking about it pw-dot would have been a more straightforward way to find this information as it shows the link state too :smile: .

In any case now I understand why our pipeline stays active. The question is if there is something that can be done about it. Does QEMU really need to keep its streams in the active state even if no application is actually trying to use its virtual microphone? I think this is something we have to find out somehow. As far as the pw-dump output goes I do not see anything special about the QEMU stream properties I could use to somehow allow EE to unlink its filters even if the QEMU stream is active.

Ideally QEMU should pause its stream when nothing is recording from its virtual devices. But for some reason it does not do that. Muting the stream is not enough. It has to be paused or stopped.

wwmm avatar Jul 29 '22 22:07 wwmm

I use these statements for the audio part of the QEMU VM

-device intel-hda
-device hda-duplex,audiodev=snd0
-audiodev pa,id=snd0 \

This creates an Intel audio HD sound card snd0 with the driver pa (pulseaudio) of the host.

promeneur avatar Jul 30 '22 04:07 promeneur

image

it must be a bug from your platform, Im using ryzen and I have 1% usage on idle while listening music with my focusrite 2i2, weird...

A good "fix" would use a focusrite or any other usb interface, as audio usb interface when not in use automatically enter in idle state

samuk190 avatar Aug 01 '22 00:08 samuk190

it must be a bug from your platform, Im using ryzen and I have 1% usage on idle while listening music with my focusrite 2i2, weird...

The amount of CPU usage can very a lot of one model to another. The real problem here is QEMU keeping its streams in the active state all the time. That is why EasyEffects keeps using CPU even when there is not application in the virtual image actually using the QEMU virtual device.

wwmm avatar Aug 01 '22 00:08 wwmm

Perhaps it is not QEMU the problem, but the guest OS : android-x86 (android-x86.org).

I attach the scripts to create, install, execute android 7.1-r5 from android-x86.org if you want to test.

https://sourceforge.net/projects/android-x86/files/Release%207.1/android-x86_64-7.1-r5.iso/download

android_x86_7.1-r5_disk_create.sh.txt

android_x86_7.1-r5_install.sh.txt

android_x86_7.1-r5_start.sh.txt

At the step of the installation in the menu choose the advanced feature and select the automatic installation.

promeneur avatar Aug 01 '22 08:08 promeneur

My CPU is an Intel i5-7400

promeneur avatar Aug 01 '22 08:08 promeneur

I made an experiment with a VM where the guest is openSUSE Tumbleweed.

Result: 3-5 % CPU power

So the problem is QEMU or My CPU is not much powerful.

promeneur avatar Aug 01 '22 08:08 promeneur

I still would not blame the CPU. When the condition to unlink our filters is met you will see zero percent CPU usage in any CPU. But the way qemu is handling it's streams is not allowing this to happen.

wwmm avatar Aug 01 '22 11:08 wwmm