echo-cancel: Let AEC module determine source/sink spec

Since the source and sink specification will need to be determined by
the AEC algorithm (can it handle multi-channel audio, does it work with
a fixed sample rate, etc.), we negotiate these using inout parameters at
initialisation time.

There is opportunity to make the sink-handling more elegant. Since the
sink data isn't used for playback (just processing), we could pass
through the data as-is and resample to the required spec before using in
the cancellation algorithm. This isn't too important immediately, but
would be nice to have.
This commit is contained in:
Arun Raghavan 2010-09-06 22:23:51 +05:30
parent 668f4e49b6
commit c975dfa5a5
3 changed files with 49 additions and 24 deletions

View file

@ -46,7 +46,12 @@ struct pa_echo_canceller_params {
typedef struct pa_echo_canceller pa_echo_canceller;
struct pa_echo_canceller {
pa_bool_t (*init) (pa_echo_canceller *ec, pa_sample_spec ss, pa_channel_map map, const char *args);
pa_bool_t (*init) (pa_echo_canceller *ec,
pa_sample_spec *source_ss,
pa_channel_map *source_map,
pa_sample_spec *sink_ss,
pa_channel_map *sink_map,
const char *args);
void (*run) (pa_echo_canceller *ec, uint8_t *rec, uint8_t *play, uint8_t *out);
void (*done) (pa_echo_canceller *ec);
uint32_t (*get_block_size) (pa_echo_canceller *ec);
@ -55,7 +60,10 @@ struct pa_echo_canceller {
};
/* Speex canceller functions */
pa_bool_t pa_speex_ec_init(pa_echo_canceller *ec, pa_sample_spec ss, pa_channel_map map, const char *args);
pa_bool_t pa_speex_ec_init(pa_echo_canceller *ec,
pa_sample_spec *source_ss, pa_channel_map *source_map,
pa_sample_spec *sink_ss, pa_channel_map *sink_map,
const char *args);
void pa_speex_ec_run(pa_echo_canceller *ec, uint8_t *rec, uint8_t *play, uint8_t *out);
void pa_speex_ec_done(pa_echo_canceller *ec);
uint32_t pa_speex_ec_get_block_size(pa_echo_canceller *ec);