Commit a20e7638 authored by Marijn Suijten's avatar Marijn Suijten 🦀

fixup! bluetooth: Delay A2DP Absolute Volume setup until property is available

TODO: This is still not the right place. Doing a codec change doesn't
call this function and hence not set up the callbacks until the peer
sends AVRCP messages.
parent cc1101d4
Pipeline #221587 passed with stages
in 5 minutes
......@@ -708,6 +708,12 @@ static void bluez5_transport_request_volume(pa_bluetooth_transport *t) {
send_and_add_to_pending(t->device->discovery, m, request_volume_reply, t);
}
void pa_bluetooth_transport_setup_a2dp_absolute_volume(pa_bluetooth_transport *t) {
pa_assert(t);
/* A2DP Absolute Volume control (AVRCP 1.4) is optional */
bluez5_transport_request_volume(t);
}
bool pa_bluetooth_device_any_transport_connected(const pa_bluetooth_device *d) {
unsigned i, bluetooth_profile_count;
......@@ -2422,9 +2428,6 @@ static DBusMessage *endpoint_set_configuration(DBusConnection *conn, DBusMessage
pa_log_debug("Transport %s available for profile %s", t->path, pa_bluetooth_profile_to_string(t->profile));
/* A2DP Absolute Volume control (AVRCP 1.4) is optional */
bluez5_transport_request_volume(t);
return NULL;
fail:
......
......@@ -157,6 +157,7 @@ pa_bluetooth_transport *pa_bluetooth_transport_get(pa_bluetooth_discovery *y, co
pa_hashmap *pa_bluetooth_transport_get_all(pa_bluetooth_discovery *y);
void pa_bluetooth_transport_put(pa_bluetooth_transport *t);
void pa_bluetooth_transport_free(pa_bluetooth_transport *t);
void pa_bluetooth_transport_setup_a2dp_absolute_volume(pa_bluetooth_transport *t);
size_t pa_bluetooth_device_find_a2dp_endpoints_for_codec(const pa_bluetooth_device *device, const pa_a2dp_codec *a2dp_codec, bool is_a2dp_sink, const char **endpoints, size_t endpoints_max_count);
bool pa_bluetooth_device_change_a2dp_profile(pa_bluetooth_device *d, pa_bluetooth_profile_t profile);
......
......@@ -2020,6 +2020,9 @@ static int set_profile_cb(pa_card *c, pa_card_profile *new_profile) {
if (start_thread(u) < 0)
goto off;
if (u->transport)
pa_bluetooth_transport_setup_a2dp_absolute_volume(u->transport);
return 0;
off:
......@@ -2433,8 +2436,11 @@ static void sink_set_a2dp_remote_controlled(pa_sink *s) {
// nice on the ears...
pa_sink_set_set_volume_callback(s, NULL);
/* Reset local attenuation */
pa_sink_enter_passthrough(s);
if (!PA_SINK_IS_LINKED(s->state) || (s->monitor_source && !PA_SOURCE_IS_LINKED(s->monitor_source->state)))
pa_log_error("Sink or monitor source are not linked, can't set passthrough!");
else
/* Reset local attenuation */
pa_sink_enter_passthrough(s);
pa_sink_set_set_volume_callback(s, sink_set_volume_cb);
}
......@@ -2638,6 +2644,9 @@ int pa__init(pa_module* m) {
if (start_thread(u) < 0)
goto off;
if (u->transport)
pa_bluetooth_transport_setup_a2dp_absolute_volume(u->transport);
return 0;
off:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment