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

High CPU usage when playing audio #154

Closed
jaredmoody opened this issue Mar 19, 2022 · 4 comments
Closed

High CPU usage when playing audio #154

jaredmoody opened this issue Mar 19, 2022 · 4 comments

Comments

@jaredmoody
Copy link
Contributor

While listening today, I noticed a stutter every so often in playback, and traced that to very high CPU usage from black candy when playing in Safari

Activity Monitor 2022-03-18 17-14-35

It is a large file encoded in ALAC, and while I have "Allow transcode lossless" switched on, I'm seeing AAC listed in the safari network pane, so perhaps the transcode is happening on my local machine which is causing the high CPU.

Settings 2022-03-18 17-20-08

I don't have this same issue in Jellyfin, my current primary player which I'd like to switch away from, so seems specific to BlackCandy, and when playing in Jellyfin, it looks like it is transcoding to m4a:

Jellyfin 2022-03-18 17-23-16

@aidewoode
Copy link
Member

ALAC encoded file can stored within an mp4 container with .m4a filename extension. You know .m4a filename extension can also be used as lossy formate. Black candy just simple use filename extension to check if the formate is lossless or not. So like ALAC encoded file, black candy just treat it as a lossy formate. So there is no transcoding when playing ALAC encoded file. I am not quite sure why playing ALAC encoded file cause high CPU usage. This need deeper investigation. It would be great if you can send me the sample file that cause high CPU usage.

@jaredmoody
Copy link
Contributor Author

@aidewoode
Copy link
Member

I got the file. Thanks

aidewoode added a commit that referenced this issue Jun 27, 2022
Fix #154, high CPU usage when playing audio on safari
@aidewoode
Copy link
Member

aidewoode commented Jun 27, 2022

Hi, I have founded the reason why the high CPU usage when playing audio on safari. It's not because the issue of transcoding. When I was playing mp3 I still got high CPU usage on safari. On my laptop it's about 50% usage on CPU. Then I've founded that's because I update the DOM of song playback timer on window.requestAnimationFrame, that will cause a lot of repaint on safari therefore high CPU usage.

But on this issue there is another problem need to be solved. The problem is black candy can not check if the formate is lossless or not when the formate use general container, like mp4 container. And I will create another issue for this problem.

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

No branches or pull requests

2 participants