a2dp: automatic delay estimation

This commit is contained in:
Gabriel Ebner 2020-12-23 19:13:54 +01:00 committed by Wim Taymans
parent 7bdcfb6383
commit af38edea82
3 changed files with 15 additions and 1 deletions

View file

@ -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,

View file

@ -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);
}

View file

@ -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;