From 27433c400092aa730d0f110211a33eed9073683e Mon Sep 17 00:00:00 2001 From: Huang-Huang Bao Date: Thu, 3 Jun 2021 05:26:34 +0800 Subject: [PATCH] bluez5: clean up node volume emitting The problem described in previous 'volume_changed()' has been fixed in 5bf21444384a515de63fe1194bea5b4bb2ffd24f, hence we don't need that workaround anymore. --- spa/plugins/bluez5/bluez5-device.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/spa/plugins/bluez5/bluez5-device.c b/spa/plugins/bluez5/bluez5-device.c index 9ea3366b2..701b88d65 100644 --- a/spa/plugins/bluez5/bluez5-device.c +++ b/spa/plugins/bluez5/bluez5-device.c @@ -313,14 +313,11 @@ static void volume_changed(void *userdata) node_update_soft_volumes(node, t_volume->volume); + emit_volume(impl, node); + impl->info.change_mask |= SPA_DEVICE_CHANGE_MASK_PARAMS; impl->params[IDX_Route].flags ^= SPA_PARAM_INFO_SERIAL; emit_info(impl, false); - - /* It sometimes flips volume to over 100% in pavucontrol slider - * if volume is emitted before route info emitting while node - * volumes are not identical to route volumes. Not sure why. */ - emit_volume(impl, node); } static const struct spa_bt_transport_events transport_events = { @@ -1535,7 +1532,7 @@ static int node_set_volume(struct impl *this, struct node *node, float volumes[] if (n_volumes == 0) return -EINVAL; - spa_log_debug(this->log, "node %p volume %f", node, volumes[0]); + spa_log_info(this->log, "node %p volume %f", node, volumes[0]); for (i = 0; i < node->n_channels; i++) { if (node->volumes[i] == volumes[i % n_volumes]) @@ -1558,6 +1555,8 @@ static int node_set_volume(struct impl *this, struct node *node, float volumes[] node->soft_volumes[i] = node->volumes[i]; } + emit_volume(this, node); + return changed; } @@ -1744,8 +1743,6 @@ static int impl_set_param(void *object, this->params[IDX_Route].flags ^= SPA_PARAM_INFO_SERIAL; } emit_info(this, false); - /* See volume_changed(void *) */ - emit_volume(this, node); } break; }