Re: problem with module-role-ducking, ducked stream occasionally unmutes / switches / breaks through

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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




[Index of Archives]     [Linux Audio Users]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux