Skip to content

Commit

Permalink
Filter internal delay D-Bus signals
Browse files Browse the repository at this point in the history
Only emit D-Bus delay signal for internal processing delays if the
change is >= 10ms
  • Loading branch information
borine committed Dec 23, 2024
1 parent fb0aa0b commit 924eb34
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions src/ba-transport-pcm.c
Original file line number Diff line number Diff line change
Expand Up @@ -783,16 +783,17 @@ int ba_transport_pcm_delay_sync(struct ba_transport_pcm *pcm, unsigned int updat

}
}
else {
if (pcm->mode == BA_TRANSPORT_PCM_MODE_SINK &&
update_mask == BA_DBUS_PCM_UPDATE_DELAY) {

/* If the remote device does not provide delay update reports we can still
* inform local D-Bus clients of our internal processing delay. */
if ((t->profile & BA_TRANSPORT_PROFILE_MASK_A2DP) == 0 ||
!t->a2dp.delay_reporting) {

if (update_mask == BA_DBUS_PCM_UPDATE_DELAY) {

/* To avoid creating a flood of dbus signals, we only notify clients
* when the codec + processing value changes by more than 10ms */
unsigned int delay = 0;
if (t->profile == BA_TRANSPORT_PROFILE_A2DP_SOURCE)
delay += t->a2dp.delay;

delay += t->pcm->codec_delay_dms + pcm->processing_delay_dms;
unsigned int delay = pcm->codec_delay_dms + pcm->processing_delay_dms;
unsigned int diff = delay >= pcm->reported_codec_delay_dms ?
delay - pcm->reported_codec_delay_dms :
pcm->reported_codec_delay_dms - delay;
Expand Down

0 comments on commit 924eb34

Please sign in to comment.