[pulseaudio-discuss] [PATCH] stream-interaction: Don't reset interaction state when ducking

Juho Hämäläinen jusa at hilvi.org
Mon Jul 2 12:22:01 UTC 2018

If the interaction state would be reset when ducking, it could happen
that we apply volume factor to a sink-input that already has volume
factor applied by us. For example when volume factor is applied while
a sink-input is running and the sink-input is moved to another sink,
there will be assertion failure from pa_sink_input_add_volume_factor()
when calling pa_hashmap_put().

Signed-off-by: Juho Hämäläinen <jusa at hilvi.org>
 src/modules/stream-interaction.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/modules/stream-interaction.c b/src/modules/stream-interaction.c
index 4184786..88cbd5d 100644
--- a/src/modules/stream-interaction.c
+++ b/src/modules/stream-interaction.c
@@ -243,7 +243,10 @@ static pa_hook_result_t process(struct userdata *u, pa_sink_input *i, bool creat
-    if (!create)
+    /* Reset interaction states only for cork/mute. If we would reset interaction state
+     * for ducking, we could apply volume factor to sink-input that already has volume
+     * factor applied by us. */
+    if (!u->duck && !create)
         for (j = 0; j < u->n_groups; j++)
             pa_hashmap_remove(u->groups[j]->interaction_state, i);

More information about the pulseaudio-discuss mailing list