module-roc: add some more options

To configure the resampler backend and latency-tuner. This is mostly
to work around potential bugs in the ROC resampler backend.

See #4516
This commit is contained in:
Wim Taymans 2025-02-18 15:51:39 +01:00
parent 8cd8138cc8
commit 3270bd4552
2 changed files with 93 additions and 9 deletions

View file

@ -16,7 +16,7 @@
static inline int pw_roc_parse_fec_encoding(roc_fec_encoding *out, const char *str)
{
if (!str || !*str)
if (!str || !*str || spa_streq(str, "default"))
*out = ROC_FEC_ENCODING_DEFAULT;
else if (spa_streq(str, "disable"))
*out = ROC_FEC_ENCODING_DISABLE;
@ -31,7 +31,7 @@ static inline int pw_roc_parse_fec_encoding(roc_fec_encoding *out, const char *s
static inline int pw_roc_parse_resampler_profile(roc_resampler_profile *out, const char *str)
{
if (!str || !*str)
if (!str || !*str || spa_streq(str, "default"))
*out = ROC_RESAMPLER_PROFILE_DEFAULT;
else if (spa_streq(str, "high"))
*out = ROC_RESAMPLER_PROFILE_HIGH;
@ -44,6 +44,47 @@ static inline int pw_roc_parse_resampler_profile(roc_resampler_profile *out, con
return 0;
}
static inline int pw_roc_parse_resampler_backend(roc_resampler_backend *out, const char *str)
{
if (!str || !*str || spa_streq(str, "default"))
*out = ROC_RESAMPLER_BACKEND_DEFAULT;
else if (spa_streq(str, "builtin"))
*out = ROC_RESAMPLER_BACKEND_BUILTIN;
else if (spa_streq(str, "speex"))
*out = ROC_RESAMPLER_BACKEND_SPEEX;
else if (spa_streq(str, "speexdec"))
*out = ROC_RESAMPLER_BACKEND_SPEEXDEC;
else
return -EINVAL;
return 0;
}
static inline int pw_roc_parse_latency_tuner_backend(roc_latency_tuner_backend *out, const char *str)
{
if (!str || !*str || spa_streq(str, "default"))
*out = ROC_LATENCY_TUNER_BACKEND_DEFAULT;
else if (spa_streq(str, "niq"))
*out = ROC_LATENCY_TUNER_BACKEND_NIQ;
else
return -EINVAL;
return 0;
}
static inline int pw_roc_parse_latency_tuner_profile(roc_latency_tuner_profile *out, const char *str)
{
if (!str || !*str || spa_streq(str, "default"))
*out = ROC_LATENCY_TUNER_PROFILE_DEFAULT;
else if (spa_streq(str, "intact"))
*out = ROC_LATENCY_TUNER_PROFILE_INTACT;
else if (spa_streq(str, "responsive"))
*out = ROC_LATENCY_TUNER_PROFILE_RESPONSIVE;
else if (spa_streq(str, "gradual"))
*out = ROC_LATENCY_TUNER_PROFILE_GRADUAL;
else
return -EINVAL;
return 0;
}
static inline int pw_roc_create_endpoint(roc_endpoint **result, roc_protocol protocol, const char *ip, int port)
{
roc_endpoint *endpoint;