[pulseaudio-commits] [Git][pulseaudio/pulseaudio][master] switch-on-connect: Blacklist HDMI devices by default
Georg Chini
gitlab at gitlab.freedesktop.org
Fri Dec 27 19:20:55 UTC 2019
Georg Chini pushed to branch master at PulseAudio / pulseaudio
Commits:
cdcb0188 by Tanu Kaskinen at 2019-12-27T11:24:36+02:00
switch-on-connect: Blacklist HDMI devices by default
As the comment says, switching to HDMI automatically often causes
problems. Commit bae8c16bfadb43c596b03f9c7ff7c9e9f1709b76
("switch-on-connect: Do not ignore HDMI sinks") enabled switching to
HDMI earlier. It was known already then that HDMI monitors don't
necessarily have speakers on them, but I accepted the patch on the
basis that module-switch-on-connect acts only if the card profile is
switched to HDMI, so if switching to HDMI is wrong, then already the
profile switch should cause problems. I didn't think of the case where
the default sink is on some other card, in which case switching the
profile on the HDMI card doesn't cause problems by itself.
I don't want to revert bae8c16bfa, because João needs to be able to
configure their systems to automatically switch to HDMI. Instead, this
patch utilizes the new blacklisting feature in module-switch-on-connect
to blacklist HDMI sinks by default. Switching to HDMI can be enabled by
setting the blacklist modarg to an empty string or something that
doesn't match HDMI sinks.
Fixes: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/issues/749
- - - - -
1 changed file:
- src/modules/module-switch-on-connect.c
Changes:
=====================================
src/modules/module-switch-on-connect.c
=====================================
@@ -33,6 +33,12 @@
#include <pulsecore/namereg.h>
#include <pulsecore/core-util.h>
+/* Ignore HDMI devices by default. HDMI monitors don't necessarily have audio
+ * output on them, and even if they do, waking up from sleep or changing
+ * monitor resolution may appear as a plugin event, which causes trouble if the
+ * user doesn't want to use the monitor for audio. */
+#define DEFAULT_BLACKLIST "hdmi"
+
PA_MODULE_AUTHOR("Michael Terry");
PA_MODULE_DESCRIPTION("When a sink/source is added, switch to it or conditionally switch to it");
PA_MODULE_VERSION(PACKAGE_VERSION);
@@ -202,7 +208,14 @@ int pa__init(pa_module*m) {
goto fail;
}
- u->blacklist = pa_xstrdup(pa_modargs_get_value(ma, "blacklist", NULL));
+ u->blacklist = pa_xstrdup(pa_modargs_get_value(ma, "blacklist", DEFAULT_BLACKLIST));
+
+ /* An empty string disables all blacklisting. */
+ if (!*u->blacklist) {
+ pa_xfree(u->blacklist);
+ u->blacklist = NULL;
+ }
+
if (u->blacklist != NULL && !pa_is_regex_valid(u->blacklist)) {
pa_log_error("A blacklist pattern was provided but is not a valid regex");
pa_xfree(u->blacklist);
View it on GitLab: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/commit/cdcb01889c785f16ca8893ee4735ea31f710bdb7
--
View it on GitLab: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/commit/cdcb01889c785f16ca8893ee4735ea31f710bdb7
You're receiving this email because of your account on gitlab.freedesktop.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/pulseaudio-commits/attachments/20191227/bd631d99/attachment-0001.htm>
More information about the pulseaudio-commits
mailing list