virtual-source-common: Integrate uplink sink into virtual source library

This patch integrates the uplink sink feature of module-virtual-source into
the virtual source library, so that every virtual source can use it.

The patch also introduces latency handling and rewinding for the uplink sink.
Similar to the monitor source, the only useful definition of the latency
appears to be the negative of the master source latency. Rewinding will not
be possible in most situations, because the underlying memblockq is nearly
always empty.
module-combine-sink and module-suspend-on-idle required some changes to
deal correctly with this type of sink.
This commit is contained in:
Georg Chini 2021-05-01 14:47:43 +02:00
parent 0b26ed9b0c
commit 9f70ad3c95
10 changed files with 512 additions and 249 deletions

View file

@ -287,6 +287,7 @@ pa_sink* pa_sink_new(
s->inputs = pa_idxset_new(NULL, NULL);
s->n_corked = 0;
s->vsink = NULL;
s->uplink_of = NULL;
s->reference_volume = s->real_volume = data->volume;
pa_cvolume_reset(&s->soft_volume, s->sample_spec.channels);
@ -2552,7 +2553,7 @@ unsigned pa_sink_check_suspend(pa_sink *s, pa_sink_input *ignore_input, pa_sourc
}
if (s->monitor_source)
ret += pa_source_check_suspend(s->monitor_source, ignore_output);
ret += pa_source_check_suspend(s->monitor_source, ignore_input, ignore_output);
return ret;
}
@ -3258,6 +3259,9 @@ void pa_sink_invalidate_requested_latency(pa_sink *s, bool dynamic) {
if (PA_SINK_IS_LINKED(s->thread_info.state)) {
if (s->uplink_of && s->uplink_of->source)
pa_source_invalidate_requested_latency(s->uplink_of->source, dynamic);
if (s->update_requested_latency)
s->update_requested_latency(s);