source: Introduce vsource structure

This patch introduces a vsource structure analog to the vsink structure.
The structure will be used for virtual source consolidation.
This commit is contained in:
Georg Chini 2021-01-25 21:57:07 +01:00
parent 95be21c736
commit b6ccb7e76d
5 changed files with 134 additions and 15 deletions

View file

@ -1306,10 +1306,20 @@ bool pa_source_output_may_move(pa_source_output *o) {
bool pa_source_output_is_filter_loop(pa_source_output *target, pa_source *s) {
unsigned PA_UNUSED i = 0;
while (s && s->output_from_master) {
if (s->output_from_master == target)
return true;
s = s->output_from_master->source;
/* During consolidation, we have to support s->output_from_master and
* s->vsource->output_from_master. The first will disappear after all
* virtual sources use the new code. */
while (s && (s->output_from_master || (s->vsource && s->vsource->output_from_master))) {
if (s->vsource) {
if (s->vsource->output_from_master == target)
return true;
s = s->vsource->output_from_master->source;
} else {
if (s->output_from_master == target)
return true;
s = s->output_from_master->source;
}
pa_assert(i++ < 100);
}
return false;
@ -1321,8 +1331,11 @@ static bool is_filter_source_moving(pa_source_output *o) {
if (!source)
return false;
while (source->output_from_master) {
source = source->output_from_master->source;
while (source->output_from_master || (source->vsource && source->vsource->output_from_master)) {
if (source->vsource)
source = source->vsource->output_from_master->source;
else
source = source->output_from_master->source;
if (!source)
return true;