mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-04 13:29:59 -05:00
echo-cancel: Enable different blocksizes for sink and source
In order to support different blocksizes for source and sink (e.g, for 4-to-1 beamforming/echo canceling which involves 4 record channels and 1 playback channel) the AEC API is altered: The blocksize for source and sink may differ (due to different sample specs) but the number of frames that are processed in one invokation of the AEC implementation's run() function is the same for the playback and the record stream. Consequently, the AEC implementation's init() function initalizes 'nframes' instead of 'blocksize' and the source's and sink's blocksizes are derived from 'nframes'. The old API also caused code duplication in each AEC implementation's init function for the compution of the blocksize, which is eliminated by the new API. Signed-off-by: Stefan Huber <s.huber@bct-electronic.com> Acked-by: Peter Meerwald <p.meerwald@bct-electronic.com>
This commit is contained in:
parent
84e4584322
commit
3a92be3c5c
6 changed files with 88 additions and 84 deletions
|
|
@ -79,7 +79,7 @@ static int routing_mode_from_string(const char *rmode) {
|
|||
pa_bool_t pa_webrtc_ec_init(pa_core *c, pa_echo_canceller *ec,
|
||||
pa_sample_spec *source_ss, pa_channel_map *source_map,
|
||||
pa_sample_spec *sink_ss, pa_channel_map *sink_map,
|
||||
uint32_t *blocksize, const char *args)
|
||||
uint32_t *nframes, const char *args)
|
||||
{
|
||||
webrtc::AudioProcessing *apm = NULL;
|
||||
pa_bool_t hpf, ns, agc, dgc, mobile, cn;
|
||||
|
|
@ -216,7 +216,8 @@ pa_bool_t pa_webrtc_ec_init(pa_core *c, pa_echo_canceller *ec,
|
|||
|
||||
ec->params.priv.webrtc.apm = apm;
|
||||
ec->params.priv.webrtc.sample_spec = *source_ss;
|
||||
ec->params.priv.webrtc.blocksize = *blocksize = (uint64_t)pa_bytes_per_second(source_ss) * BLOCK_SIZE_US / PA_USEC_PER_SEC;
|
||||
ec->params.priv.webrtc.blocksize = (uint64_t)pa_bytes_per_second(source_ss) * BLOCK_SIZE_US / PA_USEC_PER_SEC;
|
||||
*nframes = ec->params.priv.webrtc.blocksize / pa_frame_size(source_ss);
|
||||
|
||||
pa_modargs_free(ma);
|
||||
return TRUE;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue