1/*** 2 Copyright 2012 Peter Meerwald <p.meerwald@bct-electronic.com> 3 4 PulseAudio is free software; you can redistribute it and/or modify 5 it under the terms of the GNU Lesser General Public License as published 6 by the Free Software Foundation; either version 2.1 of the License, 7 or (at your option) any later version. 8 9 PulseAudio is distributed in the hope that it will be useful, but 10 WITHOUT ANY WARRANTY; without even the implied warranty of 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 General Public License for more details. 13 14***/ 15 16#ifdef HAVE_CONFIG_H 17#include <config.h> 18#endif 19 20#include <pulse/cdecl.h> 21 22PA_C_DECL_BEGIN 23#include <pulsecore/core-util.h> 24#include <pulsecore/modargs.h> 25#include "echo-cancel.h" 26PA_C_DECL_END 27 28bool pa_null_ec_init(pa_core *c, pa_echo_canceller *ec, 29 pa_sample_spec *rec_ss, pa_channel_map *rec_map, 30 pa_sample_spec *play_ss, pa_channel_map *play_map, 31 pa_sample_spec *out_ss, pa_channel_map *out_map, 32 uint32_t *nframes, const char *args) { 33 char strss_source[PA_SAMPLE_SPEC_SNPRINT_MAX]; 34 char strss_sink[PA_SAMPLE_SPEC_SNPRINT_MAX]; 35 36 *nframes = 256; 37 ec->params.null.out_ss = *out_ss; 38 39 *rec_ss = *out_ss; 40 *rec_map = *out_map; 41 42 pa_log_debug("null AEC: nframes=%u, sample spec source=%s, sample spec sink=%s", *nframes, 43 pa_sample_spec_snprint(strss_source, sizeof(strss_source), out_ss), 44 pa_sample_spec_snprint(strss_sink, sizeof(strss_sink), play_ss)); 45 46 return true; 47} 48 49void pa_null_ec_run(pa_echo_canceller *ec, const uint8_t *rec, const uint8_t *play, uint8_t *out) { 50 /* The null implementation simply copies the recorded buffer to the output 51 buffer and ignores the play buffer. */ 52 memcpy(out, rec, 256 * pa_frame_size(&ec->params.null.out_ss)); 53} 54 55void pa_null_ec_done(pa_echo_canceller *ec) { 56} 57