audio: pipewire: Set PW_KEY_NODE_RATE to suggest a rate.

This can be used by recent pipewire to avoid resampling.
main
Oschowa 2021-08-18 12:04:38 +02:00 committed by Ethan Lee
parent bfbab53660
commit bfa159313b
1 changed files with 9 additions and 0 deletions

View File

@ -31,6 +31,14 @@
#include <pipewire/extensions/metadata.h>
#include <spa/param/audio/format-utils.h>
/* Older versions of Pipewire may not define this, but it's safe to pass at
* runtime even if older installations don't recognize it.
* Taken from src/pipewire/keys.h
*/
#ifndef PW_KEY_NODE_RATE
#define PW_KEY_NODE_RATE "node.rate"
#endif
/*
* These seem to be sane limits as Pipewire
* uses them in several of it's own modules.
@ -1110,6 +1118,7 @@ PIPEWIRE_OpenDevice(_THIS, void *handle, const char *devname, int iscapture)
PIPEWIRE_pw_properties_set(props, PW_KEY_NODE_NAME, stream_name);
PIPEWIRE_pw_properties_set(props, PW_KEY_NODE_DESCRIPTION, stream_name);
PIPEWIRE_pw_properties_setf(props, PW_KEY_NODE_LATENCY, "%u/%i", adjusted_samples, this->spec.freq);
PIPEWIRE_pw_properties_setf(props, PW_KEY_NODE_RATE, "1/%u", this->spec.freq);
PIPEWIRE_pw_properties_set(props, PW_KEY_NODE_ALWAYS_PROCESS, "true");
/*