mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-09 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
|
|
@ -28,8 +28,8 @@ PA_C_DECL_END
|
|||
pa_bool_t pa_null_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) {
|
||||
unsigned framelen = 256;
|
||||
uint32_t *nframes, const char *args) {
|
||||
*nframes = 256;
|
||||
|
||||
source_ss->format = PA_SAMPLE_S16NE;
|
||||
source_ss->channels = 1;
|
||||
|
|
@ -37,14 +37,13 @@ pa_bool_t pa_null_ec_init(pa_core *c, pa_echo_canceller *ec,
|
|||
*sink_ss = *source_ss;
|
||||
*sink_map = *source_map;
|
||||
|
||||
*blocksize = framelen * pa_frame_size(source_ss);
|
||||
|
||||
pa_log_debug("null AEC: framelen %u, blocksize %u, channels %d, rate %d", framelen, *blocksize, source_ss->channels, source_ss->rate);
|
||||
pa_log_debug("null AEC: nframes %u, channels %d, rate %d", *nframes, source_ss->channels, source_ss->rate);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void pa_null_ec_run(pa_echo_canceller *ec, const uint8_t *rec, const uint8_t *play, uint8_t *out) {
|
||||
// blocksize is nframes * frame-size
|
||||
memcpy(out, rec, 256 * 2);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue