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

strange oscillation issues in the audio that occur intermittently caused by CPU scaling event #96

Closed
bondagit opened this issue Nov 9, 2022 · 4 comments

Comments

@bondagit
Copy link
Owner

bondagit commented Nov 9, 2022

I am running my tests using Armbian distro with kernel 5.9.16 on a Rock Pi 4A.
Both tests scripts (run_test and run_latency_test) run okay.
However, I'm getting strange oscillation issues in the audio that occur intermittently.
My setup is audio generator into an AES67 node and the AES67 stream is being received by the AES67 daemon running on the Rock Pi. I'm running alsaloop on it, and sending the source stream back to the node and listening to the output.
Everything works fine most of the time, but then occasionally (could be hours, could be minutes) there will be a strange oscillation in the audio.
This oscillation/distortion passes after a few seconds or a few dozen seconds and then everything is back to normal. Until the next time that it happens... See attached image.
The tick is set to 48 - 1ms and sink buffer is at 192 - 4ms (though I've tried other buffer sizes, with no effect - the issue still happens).
Any idea what is the problem and how can I troubleshoot why is this happening?
AES67 daemon issue

@bondagit
Copy link
Owner Author

bondagit commented Nov 9, 2022

I found something maybe interesting.
I have CPU scaling via perf enabled and after about 3 hours with the daemon running I see messages like (sudo dmesg):

perf: interrupt took too long (2546 > 2500), lowering kernel.perf_event_max_sample_rate to 78500

Meaning a CPU scaling event occurred.
I suspect this can have an impact on running streams.
Check on your system if scaling is enabled:

cat /proc/sys/kernel/perf_cpu_time_max_percent

If result is not 0, (it was 25 for me) set it to 0 with:

sudo sysctl -w kernel.perf_cpu_time_max_percent=0

Please let me know if this works for you.

@bondagit
Copy link
Owner Author

bondagit commented Nov 9, 2022

Good news - your suggestion seems to have resolved the issue!
The value was 25 for my system as well, and when set to 0 (at least in the 9 hours of testing) there was no oscillation/distortion. So I'd say this did the trick.

@bondagit
Copy link
Owner Author

bondagit commented Nov 9, 2022

On some platforms CPU scaling events can have an effect on AES67 daemon streams and when such events happen there could be distortions.
The suggestion is to disable CPU scaling while using the AES67 daemon.

@bondagit
Copy link
Owner Author

bondagit commented Nov 9, 2022

I will add these settings in the scripts running the daemon tests and update the documentation with the findings.

@bondagit bondagit changed the title strange oscillation issues in the audio that occur intermittently strange oscillation issues in the audio that occur intermittently cause by CPU scaling event Nov 9, 2022
@bondagit bondagit changed the title strange oscillation issues in the audio that occur intermittently cause by CPU scaling event strange oscillation issues in the audio that occur intermittently caused by CPU scaling event Nov 9, 2022
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

1 participant