38 lines
1.2 KiB
Diff
38 lines
1.2 KiB
Diff
From 8c5ca000ef7fddd9be9cd2211d880736e97b956d Mon Sep 17 00:00:00 2001
|
|
From: Wim Taymans <wtaymans@redhat.com>
|
|
Date: Thu, 18 Feb 2021 17:47:22 +0100
|
|
Subject: [PATCH 09/30] bluez5: volumes need to be distributed to all channels
|
|
|
|
Otherwise some channels might become silent.
|
|
|
|
See #741
|
|
---
|
|
spa/plugins/bluez5/bluez5-device.c | 8 ++++++--
|
|
1 file changed, 6 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/spa/plugins/bluez5/bluez5-device.c b/spa/plugins/bluez5/bluez5-device.c
|
|
index 4698efb92..be7064941 100644
|
|
--- a/spa/plugins/bluez5/bluez5-device.c
|
|
+++ b/spa/plugins/bluez5/bluez5-device.c
|
|
@@ -923,11 +923,15 @@ static int node_set_volume(struct impl *this, struct node *node, float volumes[]
|
|
uint8_t buffer[4096];
|
|
struct spa_pod_builder b = { 0 };
|
|
struct spa_pod_frame f[1];
|
|
+ uint32_t i;
|
|
+
|
|
+ if (n_volumes == 0)
|
|
+ return -EINVAL;
|
|
|
|
spa_log_info(this->log, "node %p volume %f", node, volumes[0]);
|
|
|
|
- node->n_channels = n_volumes;
|
|
- memcpy(node->volumes, volumes, sizeof(float) * SPA_AUDIO_MAX_CHANNELS);
|
|
+ for (i = 0; i < node->n_channels; i++)
|
|
+ node->volumes[i] = volumes[i % n_volumes];
|
|
|
|
spa_pod_builder_init(&b, buffer, sizeof(buffer));
|
|
spa_pod_builder_push_object(&b, &f[0],
|
|
--
|
|
2.26.2
|
|
|