diff --git a/src/ba-transport-pcm.c b/src/ba-transport-pcm.c index 01947922a..18c36198d 100644 --- a/src/ba-transport-pcm.c +++ b/src/ba-transport-pcm.c @@ -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;