module_tizenaudio_echo_cancel_la_LDFLAGS = $(MODULE_LDFLAGS)
module_tizenaudio_echo_cancel_la_LIBADD = $(MODULE_LIBADD) libprocessor.la
module_tizenaudio_echo_cancel_la_CFLAGS = $(MODULE_CFLAGS) -DPA_MODULE_NAME=module_tizenaudio_echo_cancel
+if ENABLE_WEBRTC
+module_tizenaudio_echo_cancel_la_CFLAGS += -DSUPPORT_METHOD_WEBRTC
+endif
module_sound_player_la_SOURCES = src/module-sound-player.c
module_sound_player_la_LDFLAGS = $(MODULE_LDFLAGS)
Name: pulseaudio-modules-tizen
Summary: Pulseaudio modules for Tizen
-Version: 15.0.24
+Version: 15.0.25
Release: 0
Group: Multimedia/Audio
License: LGPL-2.1+
BuildRequires: pkgconfig(dns_sd)
BuildRequires: pkgconfig(hal-api-audio)
BuildRequires: pkgconfig(speexdsp)
+%if "%{tizen_profile_name}" != "tv"
+BuildRequires: pkgconfig(webrtc-audio-processing)
+%endif
BuildRequires: pulseaudio
BuildRequires: m4
Requires(post): /sbin/ldconfig
%reconfigure --prefix=%{_prefix} \
--disable-static \
--enable-acm \
+%if "%{tizen_profile_name}" != "tv"
+ --enable-webrtc \
+%endif
%if "%{tizen_profile_name}" == "tv"
--enable-vconf-helper
%endif
PA_MODULE_VERSION(PACKAGE_VERSION);
PA_MODULE_LOAD_ONCE(true);
PA_MODULE_USAGE(
- "method=<name of method using for echo cancellation> ");
+ "method=<name of method using for echo cancellation. [method]=webrtc, adrian, speex, reference copy > ");
#define DEFAULT_PROCESS_MSEC 10
bool enable;
uint32_t n_source_output;
- char *default_method;
+ char *force_method;
pa_thread *thread;
pa_thread_mq thread_mq;
#define PA_ECHO_CANCEL(o) (pa_echo_cancel_cast(o))
#define MEMBLOCKQ_MAXLENGTH (16 * 1024 * 1024)
-#define DEFAULT_AEC_METHOD "speex"
static const char* const valid_modargs[] = {
"method",
return 0;
}
-static int proplist_get_method(pa_proplist *p, const char *default_method, pa_processor_method_t *method) {
+static int proplist_get_method(pa_proplist *p, pa_processor_method_t *method) {
const char *m;
pa_assert(p);
if (!(m = pa_proplist_gets(p, PA_PROP_MEDIA_ECHO_CANCEL_METHOD)))
return -1;
- *method = pa_processor_get_method(m, default_method);
+ *method = pa_processor_get_method(m);
return 0;
}
static pa_hook_result_t source_output_new_cb(pa_core *c, pa_source_output_new_data *data, void *userdata) {
struct userdata *u = (struct userdata *)userdata;
pa_processor_method_t method;
+ const char *m;
pa_assert(c);
pa_assert(u);
pa_assert(data);
- if (proplist_get_method(data->proplist, u->default_method, &method) < 0)
+ if (!(m = pa_proplist_gets(data->proplist, PA_PROP_MEDIA_ECHO_CANCEL_METHOD)))
return PA_HOOK_OK;
+ method = pa_processor_get_method(m);
+
/* TODO: source-output can be moved */
data->flags |= PA_SOURCE_OUTPUT_DONT_MOVE;
data->flags |= PA_SOURCE_OUTPUT_ECHO_CANCEL;
goto fail;
}
- if (proplist_get_method(o->proplist, u->default_method, &method) < 0) {
- pa_log_error("Failed to get method");
- goto fail;
+ if (u->force_method) {
+ method = pa_processor_get_method(u->force_method);
+ } else {
+ if (proplist_get_method(o->proplist, &method) < 0) {
+ pa_log_error("Failed to get method");
+ goto fail;
+ }
}
u->source = o->source;
m->userdata = u = pa_xnew0(struct userdata, 1);
u->core = m->core;
u->m = m;
- u->default_method = pa_xstrdup(pa_modargs_get_value(ma, "method", DEFAULT_AEC_METHOD));
+ u->force_method = pa_xstrdup(pa_modargs_get_value(ma, "method", NULL));
u->echo_cancel = pa_msgobject_new(pa_echo_cancel);
u->echo_cancel->parent.process_msg = process_msg;
pa_thread_mq_done(&u->thread_mq);
- pa_xfree(u->default_method);
+ pa_xfree(u->force_method);
+
pa_xfree(u);
}
return 0;
}
-pa_processor_method_t pa_processor_get_method(const char *request_method, const char *default_method) {
- const char *selected;
+const char *pa_processor_method_to_string(pa_processor_method_t method) {
+ if (method >= PA_PROCESSOR_METHOD_MAX)
+ return NULL;
- if (!request_method || !default_method)
- return PA_PROCESSOR_SPEEX;
+ return method_table[method].name;
+}
- selected = pa_streq(request_method, "default") ? default_method : request_method;
+pa_processor_method_t pa_processor_get_method(const char *request_method) {
+ pa_processor_method_t method;
- if (pa_streq(selected, "speex"))
- return PA_PROCESSOR_SPEEX;
- else if (pa_streq(selected, "adrian"))
- return PA_PROCESSOR_ADRIAN;
+ if (pa_streq(request_method, "speex"))
+ method = PA_PROCESSOR_SPEEX;
+ else if (pa_streq(request_method, "adrian"))
+ method = PA_PROCESSOR_ADRIAN;
#ifdef SUPPORT_METHOD_WEBRTC
- else if (pa_streq(selected, "webrtc"))
- return PA_PROCESSOR_WEBRTC;
+ else if (pa_streq(request_method, "webrtc"))
+ method = PA_PROCESSOR_WEBRTC;
#endif
- else if (pa_streq(selected, "reference_copy"))
- return PA_PROCESSOR_REFERENCE_COPY;
+ else if (pa_streq(request_method, "reference_copy"))
+ method = PA_PROCESSOR_REFERENCE_COPY;
else
- return PA_PROCESSOR_SPEEX;
-}
-
-const char *pa_processor_method_to_string(pa_processor_method_t method) {
- if (method >= PA_PROCESSOR_METHOD_MAX)
- return NULL;
+ /* request_method could be had 'default' */
+ method = PA_PROCESSOR_METHOD_DEFAULT;
- return method_table[method].name;
+ pa_log_info("processing method is selected. request_method(%s), method_to_string(%s)",
+ request_method, pa_processor_method_to_string(method));
}
#ifdef __DEBUG__
PA_PROCESSOR_WEBRTC,
#endif
PA_PROCESSOR_REFERENCE_COPY,
+#ifdef SUPPORT_METHOD_WEBRTC
+ PA_PROCESSOR_METHOD_DEFAULT = PA_PROCESSOR_WEBRTC,
+#else
+ PA_PROCESSOR_METHOD_DEFAULT = PA_PROCESSOR_SPEEX,
+#endif
PA_PROCESSOR_METHOD_MAX,
} pa_processor_method_t;
int pa_processor_push_reference(pa_processor *processor, pa_memchunk *chunk);
void pa_processor_flush(pa_processor *processor);
int pa_processor_free(pa_processor *processor);
-pa_processor_method_t pa_processor_get_method(const char *requset_method, const char *default_method);
+pa_processor_method_t pa_processor_get_method(const char *requset_method);
const char *pa_processor_method_to_string(pa_processor_method_t method);
#endif