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
|
From dfef1b1c8601c4b42d739ae2ec164fba2560eb49 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 22:44:34 +0200
Subject: [PATCH 27/85] pulsecore: do not consider intermediate s-i in flat-vol
---
src/pulsecore/sink.c | 33 ++++++++++++++++++++++++++-------
1 files changed, 26 insertions(+), 7 deletions(-)
diff --git a/src/pulsecore/sink.c b/src/pulsecore/sink.c
index b9b8ae2..1d69d7f 100644
--- a/src/pulsecore/sink.c
+++ b/src/pulsecore/sink.c
@@ -1097,6 +1097,25 @@ static void update_input_soft_volume(pa_sink *s, const pa_cvolume *new_volume, c
}
/* Called from main thread */
+static pa_bool_t flat_sink_has_inputs(pa_sink *s) {
+ pa_sink_input *i;
+ uint32_t idx;
+
+ if (pa_idxset_isempty(s->inputs))
+ return FALSE;
+
+ if (!(s->flags & PA_SINK_FLAT_VOLUME))
+ return TRUE;
+
+ for (i = PA_SINK_INPUT(pa_idxset_first(s->inputs, &idx)); i; i = PA_SINK_INPUT(pa_idxset_next(s->inputs, &idx))) {
+ if (!i->origin_sink || flat_sink_has_inputs(i->origin_sink))
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+/* Called from main thread */
void pa_sink_update_flat_volume(pa_sink *s, pa_cvolume *new_volume) {
pa_sink_assert_ref(s);
@@ -1117,18 +1136,18 @@ void pa_sink_update_flat_volume(pa_sink *s, pa_cvolume *new_volume) {
return;
}
- if (pa_idxset_isempty(s->inputs)) {
+ if (!flat_sink_has_inputs(s)) {
/* In the special case that we have no sink input we leave the
* volume unmodified. */
*new_volume = s->reference_volume;
return;
- }
-
- pa_cvolume_mute(new_volume, s->channel_map.channels);
+ } else {
+ pa_cvolume_mute(new_volume, s->channel_map.channels);
- /* First let's determine the new maximum volume of all inputs
- * connected to this sink */
- get_maximum_input_volume(s, new_volume, &s->channel_map);
+ /* First let's determine the new maximum volume of all inputs
+ * connected to this sink */
+ get_maximum_input_volume(s, new_volume, &s->channel_map);
+ }
/* Then, let's update the soft volumes of all inputs connected
* to this sink */
--
1.6.3.3
|