Add PIPEWIRE_QUANTUM env variable

That tries to both set the buffersize and the samplerate of the graph.
Document them in README.md
Also add the same env variables to pw-stream and pw-filter.
This commit is contained in:
Wim Taymans 2022-01-23 11:21:18 +01:00
parent f4021c7f44
commit 0bc3d1444a
5 changed files with 43 additions and 5 deletions

View file

@ -1222,6 +1222,17 @@ filter_new(struct pw_context *context, const char *name,
}
if ((str = getenv("PIPEWIRE_LATENCY")) != NULL)
pw_properties_set(props, PW_KEY_NODE_LATENCY, str);
if ((str = getenv("PIPEWIRE_RATE")) != NULL)
pw_properties_set(props, PW_KEY_NODE_RATE, str);
if ((str = getenv("PIPEWIRE_QUANTUM")) != NULL) {
struct spa_fraction q;
if (sscanf(str, "%u/%u", &q.num, &q.denom) == 2 && q.denom != 0) {
pw_properties_setf(props, PW_KEY_NODE_RATE,
"1/%u", q.denom);
pw_properties_setf(props, PW_KEY_NODE_LATENCY,
"%u/%u", q.num, q.denom);
}
}
spa_hook_list_init(&impl->hooks);
this->properties = props;

View file

@ -1358,6 +1358,17 @@ stream_new(struct pw_context *context, const char *name,
}
if ((str = getenv("PIPEWIRE_LATENCY")) != NULL)
pw_properties_set(props, PW_KEY_NODE_LATENCY, str);
if ((str = getenv("PIPEWIRE_RATE")) != NULL)
pw_properties_set(props, PW_KEY_NODE_RATE, str);
if ((str = getenv("PIPEWIRE_QUANTUM")) != NULL) {
struct spa_fraction q;
if (sscanf(str, "%u/%u", &q.num, &q.denom) == 2 && q.denom != 0) {
pw_properties_setf(props, PW_KEY_NODE_RATE,
"1/%u", q.denom);
pw_properties_setf(props, PW_KEY_NODE_LATENCY,
"%u/%u", q.num, q.denom);
}
}
spa_hook_list_init(&impl->hooks);
this->properties = props;