stream: PIPEWIRE_AUTOCONNECT env overrides config

Always make the env variable override any config setting.

See #3299
This commit is contained in:
Wim Taymans 2023-06-18 17:09:15 +02:00
parent abb300750f
commit 901388ae00

View file

@ -2007,10 +2007,12 @@ pw_stream_connect(struct pw_stream *stream,
/* XXX this is deprecated but still used by the portal and its apps */
pw_properties_setf(stream->properties, PW_KEY_NODE_TARGET, "%d", target_id);
if ((flags & PW_STREAM_FLAG_AUTOCONNECT) &&
if ((str = getenv("PIPEWIRE_AUTOCONNECT")) != NULL)
pw_properties_set(stream->properties,
PW_KEY_NODE_AUTOCONNECT, spa_atob(str) ? "true" : "false");
else if ((flags & PW_STREAM_FLAG_AUTOCONNECT) &&
pw_properties_get(stream->properties, PW_KEY_NODE_AUTOCONNECT) == NULL) {
str = getenv("PIPEWIRE_AUTOCONNECT");
pw_properties_set(stream->properties, PW_KEY_NODE_AUTOCONNECT, str ? str : "true");
pw_properties_set(stream->properties, PW_KEY_NODE_AUTOCONNECT, "true");
}
if (flags & PW_STREAM_FLAG_DRIVER)
pw_properties_set(stream->properties, PW_KEY_NODE_DRIVER, "true");