mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2026-02-15 22:05:22 -05:00
sink, source: Rework reconfiguration logic to apply to more than rate
This rejigs the update_rate() logic to encompass changes to the sample spec as a whole, as well as passthrough status. As a result, sinks/sources provide a reconfigure() method which allows reconfiguration as required. The behaviour itself is currently unchanged -- alsa-sink/-source do not actually implement anything other than rate updates for now (nor are they ever requested to). This can be modified in the future, to allow, for example 24-bit output when incoming media supports it, as well as channel count changes for passthrough sinks. Another related change is that passthrough status is now part of sink/source reconfiguration, and we can stop doing a suspend/unsuspend when entering/leaving passthrough state. So that part is now divided in two -- pa_sink_reconfigure() sets the sink in passthrough mode if required, and pa_sink_enter_passthrough() sets up everything else (this currently means only volumes, but could disable other processing) for passthrough mode.
This commit is contained in:
parent
4f1041c271
commit
7a7072557a
8 changed files with 90 additions and 94 deletions
|
|
@ -356,7 +356,7 @@ int pa_source_output_new(
|
|||
module-suspend-on-idle can resume a source */
|
||||
|
||||
pa_log_info("Trying to change sample rate");
|
||||
if (pa_source_update_rate(data->source, data->sample_spec.rate, pa_source_output_new_data_is_passthrough(data)) >= 0)
|
||||
if (pa_source_reconfigure(data->source, &data->sample_spec, pa_source_output_new_data_is_passthrough(data)) >= 0)
|
||||
pa_log_info("Rate changed to %u Hz", data->source->sample_spec.rate);
|
||||
}
|
||||
|
||||
|
|
@ -529,7 +529,7 @@ static void source_output_set_state(pa_source_output *o, pa_source_output_state_
|
|||
!pa_sample_spec_equal(&o->sample_spec, &o->source->sample_spec)) {
|
||||
/* We were uncorked and the source was not playing anything -- let's try
|
||||
* to update the sample rate to avoid resampling */
|
||||
pa_source_update_rate(o->source, o->sample_spec.rate, pa_source_output_is_passthrough(o));
|
||||
pa_source_reconfigure(o->source, &o->sample_spec, pa_source_output_is_passthrough(o));
|
||||
}
|
||||
|
||||
pa_assert_se(pa_asyncmsgq_send(o->source->asyncmsgq, PA_MSGOBJECT(o), PA_SOURCE_OUTPUT_MESSAGE_SET_STATE, PA_UINT_TO_PTR(state), 0, NULL) == 0);
|
||||
|
|
@ -1523,7 +1523,7 @@ int pa_source_output_finish_move(pa_source_output *o, pa_source *dest, bool save
|
|||
SOURCE_OUTPUT_MOVE_FINISH hook */
|
||||
|
||||
pa_log_info("Trying to change sample rate");
|
||||
if (pa_source_update_rate(dest, o->sample_spec.rate, pa_source_output_is_passthrough(o)) >= 0)
|
||||
if (pa_source_reconfigure(dest, &o->sample_spec, pa_source_output_is_passthrough(o)) >= 0)
|
||||
pa_log_info("Rate changed to %u Hz", dest->sample_spec.rate);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue