mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-19 07:00:03 -05:00
echo-cancel: Convert AGC API to deal with pa_volume_t
It is expected that the underlying AGC mechanism will likely provide a single volume for the source rather than a per-channel volume. Dealing with per-channel volumes just adds complexity with regards to the actual volume setting (depending on whether volume sharing is enabled or not, we would set the volume on the source output of the virtual source, and their sample specs may be different). Using a single volume allows us to sidestep this problem entirely.
This commit is contained in:
parent
05a6af744b
commit
fa2b0b4aad
3 changed files with 22 additions and 24 deletions
|
|
@ -529,7 +529,6 @@ void pa_webrtc_ec_record(pa_echo_canceller *ec, const uint8_t *rec, uint8_t *out
|
|||
const pa_sample_spec *out_ss = &ec->params.webrtc.out_ss;
|
||||
float **buf = ec->params.webrtc.rec_buffer;
|
||||
int n = ec->params.webrtc.blocksize;
|
||||
pa_cvolume v;
|
||||
int old_volume, new_volume;
|
||||
webrtc::StreamConfig rec_config(rec_ss->rate, rec_ss->channels, false);
|
||||
webrtc::StreamConfig out_config(out_ss->rate, out_ss->channels, false);
|
||||
|
|
@ -537,9 +536,8 @@ void pa_webrtc_ec_record(pa_echo_canceller *ec, const uint8_t *rec, uint8_t *out
|
|||
pa_deinterleave(rec, (void **) buf, rec_ss->channels, pa_sample_size(rec_ss), n);
|
||||
|
||||
if (ec->params.webrtc.agc) {
|
||||
pa_cvolume_init(&v);
|
||||
pa_echo_canceller_get_capture_volume(ec, &v);
|
||||
old_volume = webrtc_volume_from_pa(pa_cvolume_avg(&v));
|
||||
pa_volume_t v = pa_echo_canceller_get_capture_volume(ec);
|
||||
old_volume = webrtc_volume_from_pa(v);
|
||||
apm->gain_control()->set_stream_analog_level(old_volume);
|
||||
}
|
||||
|
||||
|
|
@ -558,10 +556,8 @@ void pa_webrtc_ec_record(pa_echo_canceller *ec, const uint8_t *rec, uint8_t *out
|
|||
new_volume = apm->gain_control()->stream_analog_level();
|
||||
}
|
||||
|
||||
if (old_volume != new_volume) {
|
||||
pa_cvolume_set(&v, rec_ss->channels, webrtc_volume_to_pa(new_volume));
|
||||
pa_echo_canceller_set_capture_volume(ec, &v);
|
||||
}
|
||||
if (old_volume != new_volume)
|
||||
pa_echo_canceller_set_capture_volume(ec, webrtc_volume_to_pa(new_volume));
|
||||
}
|
||||
|
||||
pa_interleave((const void **) buf, out_ss->channels, out, pa_sample_size(out_ss), n);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue