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:
Arun Raghavan 2017-09-03 16:53:17 +05:30
parent 4f1041c271
commit 7a7072557a
8 changed files with 90 additions and 94 deletions

View file

@ -108,7 +108,6 @@ struct pa_sink {
/* Saved volume state while we're in passthrough mode */
pa_cvolume saved_volume;
bool saved_save_volume:1;
bool is_passthrough_set:1;
pa_asyncmsgq *asyncmsgq;
@ -245,9 +244,9 @@ struct pa_sink {
* set). Makes a copy of the formats passed in. */
bool (*set_formats)(pa_sink *s, pa_idxset *formats); /* may be NULL */
/* Called whenever the sampling frequency shall be changed. Called from
/* Called whenever device parameters need to be changed. Called from
* main thread. */
int (*update_rate)(pa_sink *s, uint32_t rate);
int (*reconfigure)(pa_sink *s, pa_sample_spec *spec, bool passthrough);
/* Contains copies of the above data so that the real-time worker
* thread can work without access locking */
@ -423,7 +422,7 @@ unsigned pa_device_init_priority(pa_proplist *p);
/**** May be called by everyone, from main context */
int pa_sink_update_rate(pa_sink *s, uint32_t rate, bool passthrough);
int pa_sink_reconfigure(pa_sink *s, pa_sample_spec *spec, bool passthrough);
void pa_sink_set_port_latency_offset(pa_sink *s, int64_t offset);
/* The returned value is supposed to be in the time domain of the sound card! */