I initially included put the Speex preprocessing assuming that we'd want
to use the digital gain control and noise suppression from Speex for all
echo cancelling implementations. In practice, we're probably going to
get entire implementations all processing in one package (WebRTC, custom
modules from various vendors, etc.).
This moves out this preprocessing and related knobs into the speex
implementation, which serves to clean out all implementation-specific
details from the module-echo-cancel core.
If module initialisation fails, the speex done() function might try to
free a value that's not been allocated yet. Adding protection for this
condition.
The adrian module was using home-brewed endianness conversion instead of
the appropriate mactos, and speex assumed a little-endian host. This
fixes both of these.
Optimises the core inner-product function, which takes the most CPU. The
SSE-optimised bits of the adrian echo canceller only if the CPU that PA
is running on actually supports SSE.
Since all algorithms will need to specify a block size (the amount of
data to be processed together), we make this a common parameter and have
the implementation set it at initialisation time.
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.