bluez5: set volume for both channels when switching HFP -> A2DP

Retain mono volume level set with HFP, for A2DP, in case session manager
fails to restore it.
This commit is contained in:
Pauli Virtanen 2021-03-15 23:07:46 +02:00
parent d9c5ea54fd
commit 8f075619b2

View file

@ -156,6 +156,17 @@ static void emit_node(struct impl *this, struct spa_bt_transport *t,
spa_device_emit_object_info(&this->hooks, id, &info);
if (this->nodes[id].n_channels > 0) {
size_t i;
/*
* Spread mono volume to all channels, if we had switched HFP -> A2DP.
* XXX: we should also use different route for hfp and a2dp
*/
for (i = this->nodes[id].n_channels; i < t->n_channels; ++i)
this->nodes[id].volumes[i] = this->nodes[id].volumes[i % this->nodes[id].n_channels];
}
this->nodes[id].active = true;
this->nodes[id].n_channels = t->n_channels;
memcpy(this->nodes[id].channels, t->channels,