echo-cancel: Add infrastructure for cancellers to do AGC

This adds some infrastructure for canceller implementations to also
perform acoustic gain control. Cancellers now have a couple of new API
calls that allow them to get/set capture volume.

This is made slightly complex by the fact that cancellation happens in
thread context while most volume mangling needs to be done in main
context. To deal with this, while getting the volume we save source
volume updates as they are propagated to thread context and use this
cached value for queries. To set the volume, we send an async message to
main context and let that set the source volume.
This commit is contained in:
Arun Raghavan 2011-11-04 16:17:26 +05:30
parent a813e85503
commit 3d2f2424eb
2 changed files with 94 additions and 12 deletions

View file

@ -37,6 +37,8 @@
/* Common data structures */
typedef struct pa_echo_canceller_msg pa_echo_canceller_msg;
typedef struct pa_echo_canceller_params pa_echo_canceller_params;
struct pa_echo_canceller_params {
@ -109,8 +111,15 @@ struct pa_echo_canceller {
/* Structure with common and engine-specific canceller parameters. */
pa_echo_canceller_params params;
/* msgobject that can be used to send messages back to the main thread */
pa_echo_canceller_msg *msg;
};
/* Functions to be used by the canceller analog gain control routines */
void pa_echo_canceller_get_capture_volume(pa_echo_canceller *ec, pa_cvolume *v);
void pa_echo_canceller_set_capture_volume(pa_echo_canceller *ec, pa_cvolume *v);
/* Speex canceller functions */
pa_bool_t pa_speex_ec_init(pa_core *c, pa_echo_canceller *ec,
pa_sample_spec *source_ss, pa_channel_map *source_map,