On 12/06/2022 08:43, Sean Greenslade wrote:
On Wed, Jun 08, 2022 at 10:35:14AM +0200, Chris Beat wrote:
Hi,

I am running Kodi on an old netbook to listen to http streamed radio from the 
internet. I also use
shairport-sync to cast audio from Apple devices to the same netbook. I use 
module-role-ducking to
mute the internet radio when a stream from shairport-sync comes in, this is my 
logic:

load-module module-role-ducking volume=0 trigger_roles=ShairportRole,stream 
ducking_roles=KodiRole
PULSE_PROP='media.role=ShairportRole' /usr/bin/shairport-sync -uv
PULSE_PROP='media.role=KodiRole' /usr/bin/kodi

This all works fine and as expected EXCEPT that occasionally (maybe once a 
minute) the ducked stream
from Kodi "breaks through" (I do not know a better word) - meaning that I can 
hear a short
(subsecond) "fragment" of the Kodi stream INSTEAD of the shairport-sync stream.

I am not sure how this can be solved most effectively; maybe it is even better 
to debug this on the
shairport-sync side of things? Maybe there are better ways to mute a stream 
than ducking?

Hi, Chris.

I don't personally have any experience with Airplay or shairport-sync,
but I took a quick glance at the shairport code and I have a potential
theory. Shairport seems to cork the pulseaudio stream if it experiences
an underflow. The module-role-ducking code interprets a corked or muted
stream as inactive, which could be the cause of the momentary unducking.

A once-a-minute interval makes me think it could be a wifi scan causing
packet loss or latency. If the audio buffers are small, that could be
enough to cause an underflow. I've read about similar issues happening
with video conferencing calls done over wifi.

If you're feeling up for some debugging, it looks like there's a debug
message you could uncomment in the shairport code that would confirm if
it is indeed an underflow-induced corking event:

https://github.com/mikebrady/shairport-sync/blob/master/audio_pa.c#L370

--Sean


Hi Sean,


thanks for the hint - you might be correct in regards to the corking and the 
underruns, because I
did notice a correlation of these ducking/corking glitches with shairport-sync 
and underrun
notifications in the log of the pulseaudio daemon itself. This is a very 
underpowered old netbook -
even loading a new picture in the kodi slideshow screensaver sometimes causes 
these underrun
messages to appear. If I find the time, I'll try to verify this with the debug 
line in the
shairport-sync code as suggested by you.

Kind regards & thanks again,

Chris.

Reply via email to