Kodi Community Forum

Full Version: Turn off audio keep-alive signal while streaming video
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'm experimenting with using only Alsa with Alsaequal and Preamp on an Ubuntu 16.04 HTPC installation, the idea being to strip out as much 'unnecessary' stuff (ie pulseaudio), but retaining as much audio fidelity and control as possible.

I've discovered that setting 'keep audio device alive' to anything other than 'Never' causes a blast of hiss/static to be output to speakers during times when the audio device is not being used. This seems to be an issue with my alsa setup and the audio signal output by Kodi in order to keep the audio device alive.

Setting 'keep audio device alive' to Never solves the issue for the most part - audio is clear and crisp, and balanced the way I want it, and the audio device responds readily. However, I find that the issue happens with streaming video whenever the video has to buffer or frames are lost - loud blast of static to the speakers. This is regardless of using any of the streaming plugins or just a strm file pointing to a network streaming source.

It seems that audio keep-alive signal is sent by the Kodi player whenever the network stream needs to buffer, or otherwise halts temporarily.

Here's my question: Is there a way to disable this behaviour? Can Kodi be configured not to send this audio signal under any circumstances?

(Of course I realize my Alsa config might be to blame, but it works with everything else I've tried so I'm starting with Kodi.)

Thanks!
The noise is sent by design to keep HDMI output devices awake. They are too smart for "plain zeros" and go offline immediately. We send a bunch of noise (random noise) when starting playback or to care for underruns if there is no additional audio data while playback.

That noise values are so damn low that I can only "feel" it's not really hearing anything when I ramp up my hifi system to the maximum level.

You can patch the code to remove it: https://github.com/xbmc/xbmc/blob/master....cpp#L1082 <- see the factor: 0.00001f you can change it to 0.000000001 or something and see when you stop hearing it. Make sure your AVR still does not fall a sleep :-)
Thanks for the information fritsch.

I'll give it a go.
So, I patched the code to remove the random noise generator.

However, this is still a problem so I'm assuming it's not that. Unless there is another noise generator somewhere else that does the same thing for streaming video when the stream starts failing.

Also noticed that removing alsaequal from my .asoundrc setup also solves the problem. So, one way or another...but without the equalizer the audio is a bit flat and muddy...

Anyway, the search continues.
Yeah :-) - so selfmade pain at the end ...
Yep...but here it was a case of no pain no GAIN (see what I did there?).

But here's a good solution - Audio DSP. Since this is my htpc and I don't use it for anything else besides kodi, I don't need a global system equalizer. The adsp.biquad.filters plugin solves all my problems.
Kodi should not send noise in case of preventing the sink from buffer underruns. If this is the case, it should be changed.
(2016-10-17, 18:54)FernetMenta Wrote: [ -> ]Kodi should not send noise in case of preventing the sink from buffer underruns. If this is the case, it should be changed.

It's the case. We only have two cases. PT (either AddPause or Add IEC pause bursts) or PCM: Add noise. It should not produce any issue, cause the noise is resampled to the target format. I can't think of any other method to keep an AVR busy. It will switch off PCM on 0s.
With the nightly starting tomorrow, you can disable the noise and pure zeros will be sent to care for underruns.