[PATCH v2 8/8] stream-restore: skip entries setting action from gnome-control-center

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



When users select an output device from gnome-control-center UI, the
sink of this output device will be set to the configured_default_sink
and the default_sink, these actions are expected, but after these
actions, the gnome-control-center will call extension_cb() to modify
the entries in the database, let all stream entries to bind the sink
users select, this is not correct since the sink is default_sink now.

This is a temp fix for this issue, after gnome-control-center fixes
this problem, this patch should be reverted.

Signed-off-by: Hui Wang <hui.wang@xxxxxxxxxxxxx>
---
 src/modules/module-stream-restore.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/src/modules/module-stream-restore.c b/src/modules/module-stream-restore.c
index fd3acb5bd..b2691d384 100644
--- a/src/modules/module-stream-restore.c
+++ b/src/modules/module-stream-restore.c
@@ -2053,7 +2053,7 @@ static int extension_cb(pa_native_protocol *p, pa_module *m, pa_native_connectio
             }
 
             while (!pa_tagstruct_eof(t)) {
-                const char *name, *device;
+                const char *name, *device, *client_name;
                 bool muted;
                 struct entry *entry;
 #ifdef HAVE_DBUS
@@ -2094,7 +2094,17 @@ static int extension_cb(pa_native_protocol *p, pa_module *m, pa_native_connectio
                     entry_free(entry);
                     goto fail;
                 }
-
+                /* When users select an output device from gnome-control-center UI, the gnome-control-center will change all entries
+                 * in the database to bind the sink of this output device, this is not correct since at this moment, the sink is
+                 * default_sink and we shouldn't bind a stream to default_sink via preferred_sink or database.
+                 * After gnome-control-center fix the issue, let us remove this code */
+                client_name = pa_strnull(pa_proplist_gets(pa_native_connection_get_client(c)->proplist, PA_PROP_APPLICATION_PROCESS_BINARY));
+                if (pa_safe_streq(client_name, "gnome-control-center")) {
+                    if (entry->device_valid && m->core->default_sink && pa_safe_streq(device, m->core->default_sink->name)) {
+                        entry_free(entry);
+                        goto fail;
+                    }
+                }
 #ifdef HAVE_DBUS
                 old = entry_read(u, name);
 #endif
-- 
2.17.1

_______________________________________________
pulseaudio-discuss mailing list
pulseaudio-discuss@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss




[Index of Archives]     [Linux Audio Users]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux