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

Editor uses CPU time in the background due to the audio server being kept active #55608

Open
Tracked by #76797
davidhudson opened this issue Dec 3, 2021 · 9 comments

Comments

@davidhudson
Copy link

Godot version

3.4 Stable

System information

Windows 11 / Surface Pro 8 / i7 x86_64

Issue description

Having the editor open but minimised / unfocused eats up 1-2 hours of battery life. Cause seems to be continuous use of Windows Audio Device Graph Isolation. Desktop Window Manager usage is also much higher than when the editor is closed.

image

This can also be seen by running powercfg /requests in the terminal.

SYSTEM:
[DRIVER] Realtek High Definition Audio(SST) (INTELAUDIO\FUNC_01&VEN_10EC&DEV_0274&SUBSYS_10EC122E&REV_1000\5&1543d6b8&0&0001)
An audio stream is currently in use.

Sometimes, but not consistently this also prevents sleep when closing the keyboard cover.

Might be analogous to these issues affecting MacOS:
#28039
#38154

Maybe this is a minor issue in the grand scheme of things, but usability is impacted when you have to keep opening and closing a project when you don't expect to work on it for even a hour less you sacrifice some battery!

Steps to reproduce

Open the editor

Minimal reproduction project

No response

@Calinou
Copy link
Member

Calinou commented Dec 4, 2021

As a workaround, start the editor with the --audio-driver Dummy command line argument. This will prevent audio playback from working in the editor, but it should still work in the running project as it's a separate process.

See also #38208, which fixes this issue in the project manager (but not the editor).

Until something like #45948 is implemented on all platforms, we could add an editor setting to use the Dummy audio driver when editing any project. This way, you don't have to always specify the command line argument anymore.

@Calinou Calinou changed the title Editor Idle Power Consumption and Sleep Prevention Editor uses CPU time in the background due to the audio server being kept active Dec 4, 2021
@Calinou Calinou added this to the 4.0 milestone Feb 14, 2022
@akien-mga akien-mga removed this from the 4.0 milestone Nov 21, 2022
@wb14123
Copy link

wb14123 commented May 9, 2023

Start the editor with --audio-driver Dummy doesn't work for me. pulseaudio is still using the same amount of CPU. In KDE, I can see there is speech-dispatcher-dummy playing audio now.

@lawnjelly
Copy link
Member

lawnjelly commented May 9, 2023

Start the editor with --audio-driver Dummy doesn't work for me. pulseaudio is still using the same amount of CPU. In KDE, I can see there is speech-dispatcher-dummy playing audio now.

This is in 3.x or 4.x or both?

This sounds like a new problem related to text to speech creating an audio output. 🤔
Pinging @bruvzg as this is his area - It might be totally normal for text to speech.

@wb14123
Copy link

wb14123 commented May 9, 2023

@lawnjelly This is only in 4.x branch. When I try 3.x with --audio-driver Dummy, there is no application showing playing sound in KDE.

@bruvzg
Copy link
Member

bruvzg commented May 11, 2023

speech-dispatcher is a completely independent process, so we can't directly control what it is doing.

I guess we can postpone speech-dispatcher init until it is used, but since starting it take some time, it will make first TTS call slow, so I'm not sure about it.

Is it causing significant CPU usage, or just listed in the audio mixer?

@lawnjelly
Copy link
Member

@bruvzg Just to confirm, is there a project setting for text to speech? It should presumably be off by default unless required in the project.

@wb14123
Copy link

wb14123 commented May 12, 2023

@bruvzg It is causing significant CPU usage for pulseaudio when using --audio-driver Dummy

@bruvzg bruvzg self-assigned this May 12, 2023
@bruvzg
Copy link
Member

bruvzg commented May 12, 2023

Just to confirm, is there a project setting for text to speech? It should presumably be off by default unless required in the project.

No, there's no option to disable it completely. But if it's causing issues, we probably should add one.

when using --audio-driver Dummy

TTS is not affected by audio-driver option, since sound is generated by the speech-dispatcher (or other system component depending on OS) not by Godot.

@lawnjelly
Copy link
Member

lawnjelly commented May 15, 2023

This regression (I'm presuming the text to speech) also appears to be happening in 3.x, I'm getting up to 11 percent CPU used by pulse audio with Godot audio switched off. I'll have a look at fixing this asap, as this is a big problem for low power computers.

EDIT: I've added a separate issue for the TTS (#77124) .. it has a different cause so does deserve it's own issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants