module-echo-cancel: Add activate/deactivate methods

Add methods activate() that is called before first call to run() when
stream starts and deactivate() that is called after last call to run()
when stream stops. This makes it possible for aec-plugins to reset their
state between streams.
This commit is contained in:
Jonas Holmberg 2022-09-12 11:45:35 +02:00 committed by Jonas Holmberg
parent 0862e8c2ef
commit 70471989e5
2 changed files with 51 additions and 15 deletions

View file

@ -36,7 +36,7 @@ extern "C" {
#define SPA_TYPE_INTERFACE_AUDIO_AEC SPA_TYPE_INFO_INTERFACE_BASE "Audio:AEC"
#define SPA_VERSION_AUDIO_AEC 0
#define SPA_VERSION_AUDIO_AEC 1
struct spa_audio_aec {
struct spa_interface iface;
const char *name;
@ -60,7 +60,7 @@ struct spa_audio_aec_events {
};
struct spa_audio_aec_methods {
#define SPA_VERSION_AUDIO_AEC_METHODS 0
#define SPA_VERSION_AUDIO_AEC_METHODS 1
uint32_t version;
int (*add_listener) (void *object,
@ -71,6 +71,8 @@ struct spa_audio_aec_methods {
int (*init) (void *object, const struct spa_dict *args, const struct spa_audio_info_raw *info);
int (*run) (void *object, const float *rec[], const float *play[], float *out[], uint32_t n_samples);
int (*set_props) (void *object, const struct spa_dict *args);
int (*activate) (void *object);
int (*deactivate) (void *object);
};
#define spa_audio_aec_method(o,method,version,...) \
@ -87,6 +89,8 @@ struct spa_audio_aec_methods {
#define spa_audio_aec_init(o,...) spa_audio_aec_method(o, init, 0, __VA_ARGS__)
#define spa_audio_aec_run(o,...) spa_audio_aec_method(o, run, 0, __VA_ARGS__)
#define spa_audio_aec_set_props(o,...) spa_audio_aec_method(o, set_props, 0, __VA_ARGS__)
#define spa_audio_aec_activate(o) spa_audio_aec_method(o, activate, 1)
#define spa_audio_aec_deactivate(o) spa_audio_aec_method(o, deactivate, 1)
#ifdef __cplusplus
} /* extern "C" */