sink, source: Allow reconfigure to change the complete sample spec

For the passthrough case, we allow the entire sink sample spec to be
changed in reconfigure. This will be needed for high bitrate formats. We
duplicate this for sources to keep things in sync as well.

Relatedly, we also restore the original spec on leaving passthrough
mode. We were getting away with not doing so in the past as, while
incorrect, not restoring the rate was not disastrous. With the ability
to change channel count, not restoring breaks the meaning of profiles
entirely. The saving and restoration logic is restricted to sink/source
reconfiguration code to allow it to be self-contained and easier to
reason about.

All this also applies to the channel map. We don't actually explicitly
reconfigure the channel map at the moment, but since
pa_sink/source_reconfigure() can now change the channel count, it seems
to make sense to include the channel map along with that API change for
future use.
This commit is contained in:
Arun Raghavan 2018-05-20 08:52:10 +05:30 committed by Arun Raghavan
parent 9360dce76d
commit 0d85b18460
9 changed files with 242 additions and 76 deletions

View file

@ -1632,7 +1632,7 @@ static void source_update_requested_latency_cb(pa_source *s) {
update_sw_params(u);
}
static void source_reconfigure_cb(pa_source *s, pa_sample_spec *spec, bool passthrough) {
static int source_reconfigure_cb(pa_source *s, pa_sample_spec *spec, pa_channel_map *map, bool passthrough) {
struct userdata *u = s->userdata;
int i;
bool format_supported = false;
@ -1690,6 +1690,7 @@ static void source_reconfigure_cb(pa_source *s, pa_sample_spec *spec, bool passt
pa_smoother_2_set_sample_spec(u->smoother, pa_rtclock_now(), &effective_spec);
#endif
return 0;
}
static void thread_func(void *userdata) {