1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
From 4f3cb7240206c16d44d8f417222a2795d88562ab Mon Sep 17 00:00:00 2001
From: =?utf-8?q?Marc-Andr=C3=A9=20Lureau?= <marc-andre.lureau@nokia.com>
Date: Tue, 10 Mar 2009 17:22:11 +0200
Subject: [PATCH] pulsecore: go recursively when updating s-i flat-volume
---
src/pulsecore/sink.c | 44 ++++++++++++++++++++++++++++++--------------
1 files changed, 30 insertions(+), 14 deletions(-)
diff --git a/src/pulsecore/sink.c b/src/pulsecore/sink.c
index dc4aa2b..10f32a9 100644
--- a/src/pulsecore/sink.c
+++ b/src/pulsecore/sink.c
@@ -1067,12 +1067,40 @@ static void get_maximum_input_volume(pa_sink *s, pa_cvolume *max_volume, const p
}
/* Called from main thread */
-void pa_sink_update_flat_volume(pa_sink *s, pa_cvolume *new_volume) {
+static void update_input_soft_volume(pa_sink *s, const pa_cvolume *new_volume, const pa_channel_map *channel_map) {
pa_sink_input *i;
uint32_t idx;
pa_sink_assert_ref(s);
pa_assert(new_volume);
+
+ for (i = PA_SINK_INPUT(pa_idxset_first(s->inputs, &idx)); i; i = PA_SINK_INPUT(pa_idxset_next(s->inputs, &idx))) {
+ pa_cvolume remapped_new_volume;
+
+ if (i->origin_sink) {
+ /* go recursively on slaved flatten sink
+ * and ignore this intermediate sink-input. */
+ update_input_soft_volume(i->origin_sink, new_volume, channel_map);
+ continue;
+ }
+
+ remapped_new_volume = *new_volume;
+ pa_cvolume_remap(&remapped_new_volume, channel_map, &i->channel_map);
+ compute_new_soft_volume(i, &remapped_new_volume);
+
+ /* We don't copy soft_volume to the thread_info data here
+ * (i.e. issue PA_SINK_INPUT_MESSAGE_SET_VOLUME) because we
+ * want the update to be atomically with the sink volume
+ * update, hence we do it within the pa_sink_set_volume() call
+ * below */
+ }
+}
+
+/* Called from main thread */
+void pa_sink_update_flat_volume(pa_sink *s, pa_cvolume *new_volume) {
+
+ pa_sink_assert_ref(s);
+ pa_assert(new_volume);
pa_assert(PA_SINK_IS_LINKED(s->state));
pa_assert(s->flags & PA_SINK_FLAT_VOLUME);
@@ -1097,19 +1125,7 @@ void pa_sink_update_flat_volume(pa_sink *s, pa_cvolume *new_volume) {
/* Then, let's update the soft volumes of all inputs connected
* to this sink */
- for (i = PA_SINK_INPUT(pa_idxset_first(s->inputs, &idx)); i; i = PA_SINK_INPUT(pa_idxset_next(s->inputs, &idx))) {
- pa_cvolume remapped_new_volume;
-
- remapped_new_volume = *new_volume;
- pa_cvolume_remap(&remapped_new_volume, &s->channel_map, &i->channel_map);
- compute_new_soft_volume(i, &remapped_new_volume);
-
- /* We don't copy soft_volume to the thread_info data here
- * (i.e. issue PA_SINK_INPUT_MESSAGE_SET_VOLUME) because we
- * want the update to be atomically with the sink volume
- * update, hence we do it within the pa_sink_set_volume() call
- * below */
- }
+ update_input_soft_volume(s, new_volume, &s->channel_map);
}
/* Called from main thread */
--
1.5.6.3
|