daemon: use getenv(PIPEWIRE_CORE) for the core.name if it exists

As documented in pipewire/keys.h, PIPEWIRE_CORE is supposed to overwrite the
default value.
This commit is contained in:
Peter Hutterer 2021-05-26 16:35:46 +10:00 committed by Wim Taymans
parent f775547528
commit 2e6621fae0

View file

@ -65,6 +65,7 @@ int main(int argc, char *argv[])
int c;
char path[PATH_MAX];
const char *config_name;
const char *core_name;
if (setenv("PIPEWIRE_INTERNAL", "1", 1) < 0)
fprintf(stderr, "can't set PIPEWIRE_INTERNAL env: %m");
@ -99,6 +100,11 @@ int main(int argc, char *argv[])
PW_KEY_CONFIG_NAME, config_name,
NULL);
if ((core_name = getenv("PIPEWIRE_CORE"))) {
pw_log_info("using core.name from environment: %s", core_name);
pw_properties_set(properties, PW_KEY_CORE_NAME, core_name);
}
loop = pw_main_loop_new(&properties->dict);
if (loop == NULL) {
pw_log_error("failed to create main-loop: %m");