diff --git a/spa/plugins/bluez5/a2dp-sink.c b/spa/plugins/bluez5/a2dp-sink.c index fb7468628..7efe8de41 100644 --- a/spa/plugins/bluez5/a2dp-sink.c +++ b/spa/plugins/bluez5/a2dp-sink.c @@ -616,9 +616,11 @@ static void a2dp_on_timeout(struct spa_source *source) this->clock->nsec = now_time; this->clock->position += duration; this->clock->duration = duration; - this->clock->delay = 0; this->clock->rate_diff = 1.0f; this->clock->next_nsec = this->next_time; + + // The bluetooth AVDTP delay value is measured in units of 100us + this->clock->delay = (100 * this->transport->delay * (int64_t) this->clock->rate.denom) / SPA_USEC_PER_SEC; } spa_log_debug(this->log, NAME" %p: timeout %"PRIu64" %"PRIu64"", this, diff --git a/spa/plugins/bluez5/bluez5-dbus.c b/spa/plugins/bluez5/bluez5-dbus.c index 450abb460..cd332dca4 100644 --- a/spa/plugins/bluez5/bluez5-dbus.c +++ b/spa/plugins/bluez5/bluez5-dbus.c @@ -814,6 +814,17 @@ static int transport_update_props(struct spa_bt_transport *transport, } else if (strcmp(key, "Volume") == 0) { } + else if (strcmp(key, "Delay") == 0) { + uint16_t value; + + if (type != DBUS_TYPE_UINT16) + goto next; + dbus_message_iter_get_basic(&it[1], &value); + + spa_log_debug(monitor->log, "transport %p: %s=%02x", transport, key, value); + + transport->delay = value; + } next: dbus_message_iter_next(props_iter); } diff --git a/spa/plugins/bluez5/defs.h b/spa/plugins/bluez5/defs.h index 54155513d..d390c9a6c 100644 --- a/spa/plugins/bluez5/defs.h +++ b/spa/plugins/bluez5/defs.h @@ -288,6 +288,7 @@ struct spa_bt_transport { int fd; uint16_t read_mtu; uint16_t write_mtu; + uint16_t delay; void *user_data; struct spa_hook_list listener_list;