source: Remove output_from_master field

The only source still using the output_from_master field of the source structure
was module-echo-cancel. Due to the differences between the echo-cancel source
and the other virtual sources, consolidation did not seem useful. To faciliate
removing the output_from_master field from the source, a dummy vsource structure
was created for module-echo-cancel. After that, the output_from_master field was
removed.
This commit is contained in:
Georg Chini 2021-02-01 18:57:36 +01:00
parent 5d05301663
commit 664d175da8
7 changed files with 27 additions and 64 deletions

View file

@ -34,6 +34,7 @@
#include "echo-cancel.h"
#include <modules/virtual-sink-common.h>
#include <modules/virtual-source-common.h>
#include <pulse/xmalloc.h>
#include <pulse/timeval.h>
@ -222,6 +223,7 @@ struct userdata {
pa_rtpoll_item *rtpoll_item_read, *rtpoll_item_write;
pa_source *source;
pa_vsource *vsource;
bool source_auto_desc;
pa_source_output *source_output;
pa_memblockq *source_memblockq; /* echo canceller needs fixed sized chunks */
@ -1731,6 +1733,10 @@ int pa__init(pa_module*m) {
pa_source_set_asyncmsgq(u->source, source_master->asyncmsgq);
/* Create vsource structure. Only needed for output_from_master field, otherwise
* unused because the virtual source here is too different from other filters */
u->vsource = pa_virtual_source_vsource_new(u->source);
/* Create sink */
pa_sink_new_data_init(&sink_data);
sink_data.driver = __FILE__;
@ -1817,7 +1823,7 @@ int pa__init(pa_module*m) {
u->source_output->moving = source_output_moving_cb;
u->source_output->userdata = u;
u->source->output_from_master = u->source_output;
u->vsource->output_from_master = u->source_output;
/* Create sink input */
pa_sink_input_new_data_init(&sink_input_data);
@ -1987,6 +1993,9 @@ void pa__done(pa_module*m) {
if (u->vsink)
pa_xfree(u->vsink);
if (u->vsource)
pa_xfree(u->vsource);
if (u->source)
pa_source_unref(u->source);
if (u->sink)

View file

@ -273,7 +273,7 @@ module_echo_cancel_sources = [
module_echo_cancel_orc_sources = []
module_echo_cancel_flags = []
module_echo_cancel_deps = [libatomic_ops_dep]
module_echo_cancel_libs = [libvirtual_sink]
module_echo_cancel_libs = [libvirtual_sink, libvirtual_source]
if get_option('adrian-aec')
module_echo_cancel_sources += [

View file

@ -272,10 +272,7 @@ static bool find_paired_master(struct userdata *u, struct filter *filter, pa_obj
}
/* Make sure we're not routing to another instance of
* the same filter. */
if (so->source->vsource)
filter->source_master = so->source->vsource->output_from_master->source;
else
filter->source_master = so->source->output_from_master->source;
filter->source_master = so->source->vsource->output_from_master->source;
} else {
filter->source_master = so->source;
}
@ -477,18 +474,12 @@ static void find_filters_for_module(struct userdata *u, pa_module *m, const char
pa_assert(pa_source_is_filter(source));
if (!fltr) {
if (source->vsource)
fltr = filter_new(name, parameters, NULL, source->vsource->output_from_master->source);
else
fltr = filter_new(name, parameters, NULL, source->output_from_master->source);
fltr = filter_new(name, parameters, NULL, source->vsource->output_from_master->source);
fltr->module_index = m->index;
fltr->source = source;
} else {
fltr->source = source;
if (source->vsource)
fltr->source_master = source->vsource->output_from_master->source;
else
fltr->source_master = source->output_from_master->source;
fltr->source_master = source->vsource->output_from_master->source;
}
break;