bluetooth: reinitialize the sample spec when switching profile

When doing init_profile(), the value u->sample_spec is modified to the
one which has been last configured. In case of HSP, it will be 8kHz.

Later on, when setting the profile to A2DP, it picks up the lower rate
available which match with current u->sample_spec.

In my case, it would be 16kHz. To circunvent the issue, I decided to
reinitialize the u->sample_spec to default value with user module
argument requested rate.
This commit is contained in:
Marc-André Lureau 2009-02-10 23:48:37 +02:00
parent cac0f9ef2b
commit cce4359831

View file

@ -1568,6 +1568,14 @@ static int card_set_profile(pa_card *c, pa_card_profile *new_profile) {
} }
u->profile = *d; u->profile = *d;
/* Reinitialize the sample spec to default with module argument rate */
u->sample_spec = u->module->core->default_sample_spec;
if (pa_modargs_get_value_u32(u->modargs, "rate", &u->sample_spec.rate) < 0 ||
u->sample_spec.rate <= 0 || u->sample_spec.rate > PA_RATE_MAX) {
u->sample_spec = u->module->core->default_sample_spec;
}
init_profile(u); init_profile(u);
if (u->sink || u->source) if (u->sink || u->source)