mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-08 13:30:08 -05:00
Wire up webrtc aec parameters to args
This commit is contained in:
parent
743f699193
commit
bb407e8153
1 changed files with 70 additions and 14 deletions
|
|
@ -46,10 +46,67 @@ static void *webrtc_create(const struct pw_properties *args, const spa_audio_inf
|
||||||
webrtc::ProcessingConfig pconfig;
|
webrtc::ProcessingConfig pconfig;
|
||||||
webrtc::Config config;
|
webrtc::Config config;
|
||||||
|
|
||||||
// TODO: wire up args to control these
|
const char* prop;
|
||||||
config.Set<webrtc::ExtendedFilter>(new webrtc::ExtendedFilter(true));
|
bool extended_filter;
|
||||||
// Enable Agnostic Delay Detection, would greatly improve performance for larger latencies
|
bool delay_agnostic;
|
||||||
config.Set<webrtc::DelayAgnostic>(new webrtc::DelayAgnostic(true));
|
bool high_pass_filter;
|
||||||
|
bool noise_suppression;
|
||||||
|
bool gain_control;
|
||||||
|
bool experimental_agc;
|
||||||
|
bool experimental_ns;
|
||||||
|
bool intelligibility;
|
||||||
|
|
||||||
|
if ((prop = pw_properties_get(args, "webrtc.extended_filter")) != NULL) {
|
||||||
|
extended_filter = pw_properties_parse_bool(prop);
|
||||||
|
} else {
|
||||||
|
extended_filter = true;
|
||||||
|
}
|
||||||
|
if ((prop = pw_properties_get(args, "webrtc.delay_agnostic")) != NULL) {
|
||||||
|
delay_agnostic = pw_properties_parse_bool(prop);
|
||||||
|
} else {
|
||||||
|
delay_agnostic = true;
|
||||||
|
}
|
||||||
|
if ((prop = pw_properties_get(args, "webrtc.high_pass_filter")) != NULL) {
|
||||||
|
high_pass_filter = pw_properties_parse_bool(prop);
|
||||||
|
} else {
|
||||||
|
high_pass_filter = true;
|
||||||
|
}
|
||||||
|
if ((prop = pw_properties_get(args, "webrtc.noise_suppression")) != NULL) {
|
||||||
|
noise_suppression = pw_properties_parse_bool(prop);
|
||||||
|
} else {
|
||||||
|
noise_suppression = true;
|
||||||
|
}
|
||||||
|
if ((prop = pw_properties_get(args, "webrtc.gain_control")) != NULL) {
|
||||||
|
gain_control = pw_properties_parse_bool(prop);
|
||||||
|
} else {
|
||||||
|
// Note: AGC seems to mess up with Agnostic Delay Detection, especially with speech,
|
||||||
|
// result in very poor performance, disable by default
|
||||||
|
gain_control = false;
|
||||||
|
}
|
||||||
|
// Disable experimental flags by default
|
||||||
|
if ((prop = pw_properties_get(args, "webrtc.experimental_agc")) != NULL) {
|
||||||
|
experimental_agc = pw_properties_parse_bool(prop);
|
||||||
|
} else {
|
||||||
|
experimental_agc = false;
|
||||||
|
}
|
||||||
|
if ((prop = pw_properties_get(args, "webrtc.experimental_ns")) != NULL) {
|
||||||
|
experimental_ns = pw_properties_parse_bool(prop);
|
||||||
|
} else {
|
||||||
|
experimental_ns = false;
|
||||||
|
}
|
||||||
|
// Intelligibility Enhancer will enforce an upmix on non-mono outputs
|
||||||
|
// Disable by default
|
||||||
|
if ((prop = pw_properties_get(args, "webrtc.intelligibility")) != NULL) {
|
||||||
|
intelligibility = pw_properties_parse_bool(prop);
|
||||||
|
} else {
|
||||||
|
intelligibility = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
config.Set<webrtc::ExtendedFilter>(new webrtc::ExtendedFilter(extended_filter));
|
||||||
|
config.Set<webrtc::DelayAgnostic>(new webrtc::DelayAgnostic(delay_agnostic));
|
||||||
|
config.Set<webrtc::ExperimentalAgc>(new webrtc::ExperimentalAgc(experimental_agc));
|
||||||
|
config.Set<webrtc::ExperimentalNs>(new webrtc::ExperimentalNs(experimental_ns));
|
||||||
|
config.Set<webrtc::Intelligibility>(new webrtc::Intelligibility(intelligibility));
|
||||||
|
|
||||||
apm = webrtc::AudioProcessing::Create(config);
|
apm = webrtc::AudioProcessing::Create(config);
|
||||||
|
|
||||||
|
|
@ -65,19 +122,18 @@ static void *webrtc_create(const struct pw_properties *args, const spa_audio_inf
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: wire up args to control these
|
apm->high_pass_filter()->Enable(high_pass_filter);
|
||||||
apm->high_pass_filter()->Enable(true);
|
// Always disable drift compensation since it requires drift sampling
|
||||||
apm->echo_cancellation()->enable_drift_compensation(false);
|
apm->echo_cancellation()->enable_drift_compensation(false);
|
||||||
apm->echo_cancellation()->Enable(true);
|
apm->echo_cancellation()->Enable(true);
|
||||||
|
// TODO: wire up supression levels to args
|
||||||
apm->echo_cancellation()->set_suppression_level(webrtc::EchoCancellation::kHighSuppression);
|
apm->echo_cancellation()->set_suppression_level(webrtc::EchoCancellation::kHighSuppression);
|
||||||
apm->noise_suppression()->set_level(webrtc::NoiseSuppression::kHigh);
|
apm->noise_suppression()->set_level(webrtc::NoiseSuppression::kHigh);
|
||||||
apm->noise_suppression()->Enable(true);
|
apm->noise_suppression()->Enable(noise_suppression);
|
||||||
// FIXME: wire up args to AGC
|
// TODO: wire up AGC parameters to args
|
||||||
// Note: AGC seems to mess up with Agnostic Delay Detection, especially with speech,
|
apm->gain_control()->set_analog_level_limits(0, 255);
|
||||||
// result in very poor performance, disable by default
|
apm->gain_control()->set_mode(webrtc::GainControl::kAdaptiveDigital);
|
||||||
// apm->gain_control()->set_analog_level_limits(0, 255);
|
apm->gain_control()->Enable(gain_control);
|
||||||
// apm->gain_control()->set_mode(webrtc::GainControl::kAdaptiveDigital);
|
|
||||||
// apm->gain_control()->Enable(true);
|
|
||||||
|
|
||||||
impl = (struct impl *)calloc(1, sizeof(struct impl));
|
impl = (struct impl *)calloc(1, sizeof(struct impl));
|
||||||
impl->info = *info;
|
impl->info = *info;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue