sink: Introduce structure needed to consolidate virtual sink code

This patch introduces the vsink structure which holds all data needed
by virtual sinks. This is in preparation of the consolidation of the
virtual sink code. The input_to_master field of the sink will be moved
to the vsink structure after the consolidation. Until all virtual sinks
are converted, sink->input_to_master and sink->vsink->input_to_master
must both be supported.
This commit is contained in:
Georg Chini 2021-01-01 15:54:26 +01:00
parent ed3d4f0837
commit d18756fda9
4 changed files with 124 additions and 11 deletions

View file

@ -1784,10 +1784,20 @@ bool pa_sink_input_may_move(pa_sink_input *i) {
static bool find_filter_sink_input(pa_sink_input *target, pa_sink *s) {
unsigned PA_UNUSED i = 0;
while (s && s->input_to_master) {
if (s->input_to_master == target)
return true;
s = s->input_to_master->sink;
/* During consolidation, we have to support s->input_to_master and
* s->vsink->input_to_master. The first will disappear after all
* virtual sinks use the new code. */
while (s && (s->input_to_master || (s->vsink && s->vsink->input_to_master))) {
if (s->vsink) {
if (s->vsink->input_to_master == target)
return true;
s = s->vsink->input_to_master->sink;
} else {
if (s->input_to_master == target)
return true;
s = s->input_to_master->sink;
}
pa_assert(i++ < 100);
}
return false;
@ -1799,8 +1809,11 @@ static bool is_filter_sink_moving(pa_sink_input *i) {
if (!sink)
return false;
while (sink->input_to_master) {
sink = sink->input_to_master->sink;
while (sink->input_to_master || (sink->vsink && sink->vsink->input_to_master)) {
if (sink->vsink)
sink = sink->vsink->input_to_master->sink;
else
sink = sink->input_to_master->sink;
if (!sink)
return true;