mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-06 13:29:56 -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
|
|
@ -410,7 +410,7 @@ int pa_sink_input_new(
|
|||
module-suspend-on-idle can resume a sink */
|
||||
|
||||
pa_log_info("Trying to change sample rate");
|
||||
if (pa_sink_update_rate(data->sink, data->sample_spec.rate, pa_sink_input_new_data_is_passthrough(data)) >= 0)
|
||||
if (pa_sink_reconfigure(data->sink, &data->sample_spec, pa_sink_input_new_data_is_passthrough(data)) >= 0)
|
||||
pa_log_info("Rate changed to %u Hz", data->sink->sample_spec.rate);
|
||||
}
|
||||
|
||||
|
|
@ -609,7 +609,7 @@ static void sink_input_set_state(pa_sink_input *i, pa_sink_input_state_t state)
|
|||
!pa_sample_spec_equal(&i->sample_spec, &i->sink->sample_spec)) {
|
||||
/* We were uncorked and the sink was not playing anything -- let's try
|
||||
* to update the sample rate to avoid resampling */
|
||||
pa_sink_update_rate(i->sink, i->sample_spec.rate, pa_sink_input_is_passthrough(i));
|
||||
pa_sink_reconfigure(i->sink, &i->sample_spec, pa_sink_input_is_passthrough(i));
|
||||
}
|
||||
|
||||
pa_assert_se(pa_asyncmsgq_send(i->sink->asyncmsgq, PA_MSGOBJECT(i), PA_SINK_INPUT_MESSAGE_SET_STATE, PA_UINT_TO_PTR(state), 0, NULL) == 0);
|
||||
|
|
@ -1900,7 +1900,7 @@ int pa_sink_input_finish_move(pa_sink_input *i, pa_sink *dest, bool save) {
|
|||
SINK_INPUT_MOVE_FINISH hook */
|
||||
|
||||
pa_log_info("Trying to change sample rate");
|
||||
if (pa_sink_update_rate(dest, i->sample_spec.rate, pa_sink_input_is_passthrough(i)) >= 0)
|
||||
if (pa_sink_reconfigure(dest, &i->sample_spec, pa_sink_input_is_passthrough(i)) >= 0)
|
||||
pa_log_info("Rate changed to %u Hz", dest->sample_spec.rate);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue