mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-05 13:29:57 -05:00
modules: Add null/dummy echo canceller
I find a dummy/passthrough implementation useful for AEC debugging Signed-off-by: Peter Meerwald <p.meerwald@bct-electronic.com>
This commit is contained in:
parent
57469ce734
commit
7112e6ee3c
4 changed files with 70 additions and 1 deletions
|
|
@ -1815,7 +1815,9 @@ module_suspend_on_idle_la_CFLAGS = $(AM_CFLAGS)
|
|||
|
||||
# echo-cancel module
|
||||
module_echo_cancel_la_SOURCES = \
|
||||
modules/echo-cancel/module-echo-cancel.c modules/echo-cancel/echo-cancel.h
|
||||
modules/echo-cancel/module-echo-cancel.c \
|
||||
modules/echo-cancel/null.c \
|
||||
modules/echo-cancel/echo-cancel.h
|
||||
module_echo_cancel_la_LDFLAGS = $(MODULE_LDFLAGS)
|
||||
module_echo_cancel_la_LIBADD = $(MODULE_LIBADD) $(LIBSPEEX_LIBS)
|
||||
module_echo_cancel_la_CFLAGS = $(AM_CFLAGS) $(SERVER_CFLAGS) $(LIBSPEEX_CFLAGS)
|
||||
|
|
|
|||
|
|
@ -128,6 +128,14 @@ struct pa_echo_canceller {
|
|||
void pa_echo_canceller_get_capture_volume(pa_echo_canceller *ec, pa_cvolume *v);
|
||||
void pa_echo_canceller_set_capture_volume(pa_echo_canceller *ec, pa_cvolume *v);
|
||||
|
||||
/* Null canceller functions */
|
||||
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);
|
||||
void pa_null_ec_run(pa_echo_canceller *ec, const uint8_t *rec, const uint8_t *play, uint8_t *out);
|
||||
void pa_null_ec_done(pa_echo_canceller *ec);
|
||||
|
||||
#ifdef HAVE_SPEEX
|
||||
/* Speex canceller functions */
|
||||
pa_bool_t pa_speex_ec_init(pa_core *c, pa_echo_canceller *ec,
|
||||
|
|
|
|||
|
|
@ -82,6 +82,7 @@ PA_MODULE_USAGE(
|
|||
/* NOTE: Make sure the enum and ec_table are maintained in the correct order */
|
||||
typedef enum {
|
||||
PA_ECHO_CANCELLER_INVALID = -1,
|
||||
PA_ECHO_CANCELLER_NULL,
|
||||
#ifdef HAVE_SPEEX
|
||||
PA_ECHO_CANCELLER_SPEEX,
|
||||
#endif
|
||||
|
|
@ -100,6 +101,12 @@ typedef enum {
|
|||
#endif
|
||||
|
||||
static const pa_echo_canceller ec_table[] = {
|
||||
{
|
||||
/* Null, Dummy echo canceller (just copies data) */
|
||||
.init = pa_null_ec_init,
|
||||
.run = pa_null_ec_run,
|
||||
.done = pa_null_ec_done,
|
||||
},
|
||||
#ifdef HAVE_SPEEX
|
||||
{
|
||||
/* Speex */
|
||||
|
|
@ -1553,6 +1560,8 @@ void pa_echo_canceller_set_capture_volume(pa_echo_canceller *ec, pa_cvolume *v)
|
|||
}
|
||||
|
||||
static pa_echo_canceller_method_t get_ec_method_from_string(const char *method) {
|
||||
if (pa_streq(method, "null"))
|
||||
return PA_ECHO_CANCELLER_NULL;
|
||||
#ifdef HAVE_SPEEX
|
||||
if (pa_streq(method, "speex"))
|
||||
return PA_ECHO_CANCELLER_SPEEX;
|
||||
|
|
|
|||
50
src/modules/echo-cancel/null.c
Normal file
50
src/modules/echo-cancel/null.c
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
/***
|
||||
Copyright 2012 Peter Meerwald <p.meerwald@bct-electronic.com>
|
||||
|
||||
PulseAudio is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published
|
||||
by the Free Software Foundation; either version 2.1 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
PulseAudio is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
***/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <pulse/cdecl.h>
|
||||
|
||||
PA_C_DECL_BEGIN
|
||||
#include <pulsecore/core-util.h>
|
||||
#include <pulsecore/modargs.h>
|
||||
#include "echo-cancel.h"
|
||||
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;
|
||||
|
||||
source_ss->format = PA_SAMPLE_S16NE;
|
||||
*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);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void pa_null_ec_run(pa_echo_canceller *ec, const uint8_t *rec, const uint8_t *play, uint8_t *out) {
|
||||
memcpy(out, rec, 256 * 2);
|
||||
}
|
||||
|
||||
void pa_null_ec_done(pa_echo_canceller *ec) {
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue