sink, source: Consolidate passthrough setup in reconfigure

This moves over the saving+resetting/restoring of volumes and source
suspending/unsuspending while entering/leaving passthrough mode into
reconfigure functions. This makes it easier to reason about exactly what
behaviour occurs at the time, as well as avoids loss of precision during
the remapping of the internal volume values in this case.
This commit is contained in:
Arun Raghavan 2018-09-19 18:24:50 +05:30 committed by Arun Raghavan
parent 0d85b18460
commit cbaf278f1e
6 changed files with 50 additions and 96 deletions

View file

@ -615,9 +615,6 @@ void pa_source_output_unlink(pa_source_output*o) {
o->state = PA_SOURCE_OUTPUT_UNLINKED;
if (linked && o->source) {
if (pa_source_output_is_passthrough(o))
pa_source_leave_passthrough(o->source);
/* We might need to update the source's volume if we are in flat volume mode. */
if (pa_source_flat_volume_enabled(o->source))
pa_source_set_volume(o->source, NULL, false, false);
@ -712,9 +709,6 @@ void pa_source_output_put(pa_source_output *o) {
set_real_ratio(o, &o->volume);
}
if (pa_source_output_is_passthrough(o))
pa_source_enter_passthrough(o->source);
o->thread_info.soft_volume = o->soft_volume;
o->thread_info.muted = o->muted;
@ -1407,9 +1401,6 @@ int pa_source_output_start_move(pa_source_output *o) {
if (o->state == PA_SOURCE_OUTPUT_CORKED)
pa_assert_se(origin->n_corked-- >= 1);
if (pa_source_output_is_passthrough(o))
pa_source_leave_passthrough(o->source);
if (pa_source_flat_volume_enabled(o->source))
/* We might need to update the source's volume if we are in flat
* volume mode. */
@ -1646,9 +1637,6 @@ int pa_source_output_finish_move(pa_source_output *o, pa_source *dest, bool save
update_volume_due_to_moving(o, dest);
if (pa_source_output_is_passthrough(o))
pa_source_enter_passthrough(o->source);
pa_assert_se(pa_asyncmsgq_send(o->source->asyncmsgq, PA_MSGOBJECT(o->source), PA_SOURCE_MESSAGE_ADD_OUTPUT, o, 0, NULL) == 0);
pa_log_debug("Successfully moved source output %i to %s.", o->index, dest->name);