![]() |
UltraGrid
UltraGrid Low-Latency High-Resolution Transmission System
|
#include "audio/utils.h"#include "audio/export.h"#include "debug.h"#include "echo.h"#include <speex/speex_echo.h>#include <stdlib.h>#include <mutex>#include <memory>#include <algorithm>#include <chrono>#include "utils/ring_buffer.h"#include "host.h"
Go to the source code of this file.
Classes | |
| struct | echo_cancellation |
Macros | |
| #define | DEFAULT_FILTER_LENGTH (48 * 500) |
| #define | MOD_NAME "[Echo cancel] " |
| #define | SAMPLES_PER_FRAME (1 << 9) |
| #define | TEXTIFY(a) |
| #define | TEXTIFY2(a) |
Typedefs | |
| using | duration = steady_clock::duration |
| using | steady_clock = std::chrono::steady_clock |
| using | time_point = steady_clock::time_point |
Functions | |
| ADD_TO_PARAM ("echo-cancel-delay", "* echo-cancel-delay=<samples>\n" " Echo cancellation additional delay added to far end in samples, should be slightly less than output device latency.\n") | |
| ADD_TO_PARAM ("echo-cancel-dump-audio", "* echo-cancel-dump-audio\n" " Dump near end, far end and output samples in separate channels to a wav file.\n") | |
| ADD_TO_PARAM ("echo-cancel-filter-length", "* echo-cancel-filter-length=<samples>\n" " Echo cancellation filter length in samples, should be the third of the room's impulse response length. (default " TEXTIFY(DEFAULT_FILTER_LENGTH) ").\n") | |
| struct audio_frame * | echo_cancel (struct echo_cancellation *s, struct audio_frame *frame) |
| void | echo_cancellation_destroy (struct echo_cancellation *s) |
| struct echo_cancellation * | echo_cancellation_init (void) |
| void | echo_play (struct echo_cancellation *s, struct audio_frame *frame) |
| static void | reconfigure_echo (struct echo_cancellation *s, int sample_rate, int bps) |
Definition in file echo.cpp.
| #define DEFAULT_FILTER_LENGTH (48 * 500) |
Definition at line 61 of file echo.cpp.
Referenced by echo_cancellation_init().
| #define MOD_NAME "[Echo cancel] " |
Definition at line 63 of file echo.cpp.
Referenced by echo_cancel(), echo_cancellation_init(), and echo_play().
| #define SAMPLES_PER_FRAME (1 << 9) |
Definition at line 60 of file echo.cpp.
Referenced by echo_cancel(), echo_cancellation_init(), and echo_play().
| #define TEXTIFY | ( | a | ) |
| using steady_clock = std::chrono::steady_clock |
| using time_point = steady_clock::time_point |
| ADD_TO_PARAM | ( | "echo-cancel-delay" | , |
| "* echo-cancel- | delay = <samples>\n" " Echo cancellation additional delay added to far end in samples, | ||
| should be slightly less than output device latency.\n" | ) |
| ADD_TO_PARAM | ( | "echo-cancel-dump-audio" | , |
| "* echo-cancel-dump-audio\n" " Dump near | end, | ||
| far end and output samples in separate channels to a wav file.\n" | ) |
| ADD_TO_PARAM | ( | "echo-cancel-filter-length" | , |
| "* echo-cancel-filter- | length = <samples>\n" " Echo cancellation filter length in samples, | ||
| should be the third of the room 's impulse response length.(default " TEXTIFY(DEFAULT_FILTER_LENGTH) ").\n" | ) |
| struct audio_frame * echo_cancel | ( | struct echo_cancellation * | s, |
| struct audio_frame * | frame ) |
Definition at line 235 of file echo.cpp.
References audio_export_raw_ch(), audio_frame::bps, change_bps(), audio_frame::data, audio_frame::data_len, echo_cancellation::echo_state, error_msg, echo_cancellation::exporter, echo_cancellation::far_end_ringbuf, echo_cancellation::frame, frame, echo_cancellation::lock, LOG_LEVEL_INFO, LOG_LEVEL_WARNING, log_msg(), audio_frame::max_size, MOD_NAME, echo_cancellation::near_end_ringbuf, echo_cancellation::next_expected_near, echo_cancellation::prefill, reconfigure_echo(), echo_cancellation::requested_delay, ring_advance_read_idx(), ring_advance_write_idx(), ring_buffer_read(), ring_buffer_write(), ring_get_available_write_size(), ring_get_current_size(), ring_get_write_regions(), audio_frame::sample_rate, and SAMPLES_PER_FRAME.
Referenced by audio_sender_thread().

| void echo_cancellation_destroy | ( | struct echo_cancellation * | s | ) |
| struct echo_cancellation * echo_cancellation_init | ( | void | ) |
Definition at line 132 of file echo.cpp.
References audio_frame::bps, audio_frame::data, DEFAULT_FILTER_LENGTH, echo_cancellation::echo_state, echo_cancellation::far_end_ringbuf, echo_cancellation::frame, echo_cancellation::frame_data, get_commandline_param(), len, LOG_LEVEL_NOTICE, log_msg(), audio_frame::max_size, MOD_NAME, echo_cancellation::near_end_ringbuf, param, echo_cancellation::prefill, echo_cancellation::requested_delay, ring_buffer_init(), audio_frame::sample_rate, and SAMPLES_PER_FRAME.
Referenced by audio_init().

| void echo_play | ( | struct echo_cancellation * | s, |
| struct audio_frame * | frame ) |
Definition at line 179 of file echo.cpp.
References change_bps(), error_msg, echo_cancellation::far_end_ringbuf, frame, echo_cancellation::lock, LOG_LEVEL_NOTICE, LOG_LEVEL_WARNING, log_msg(), MOD_NAME, echo_cancellation::prefill, ring_advance_write_idx(), ring_buffer_write(), ring_get_available_write_size(), ring_get_current_size(), ring_get_write_regions(), and SAMPLES_PER_FRAME.
Referenced by audio_receiver_thread().

|
static |
Definition at line 102 of file echo.cpp.
References audio_export_configure_raw(), audio_export_init(), audio_frame::bps, audio_frame::ch_count, echo_cancellation::echo_state, echo_cancellation::exporter, echo_cancellation::far_end_ringbuf, echo_cancellation::frame, get_commandline_param(), echo_cancellation::near_end_ringbuf, ring_buffer_flush(), audio_frame::sample_rate, sample_rate, and UNUSED.
Referenced by echo_cancel().
