From cce4359831b5ff02f63e9748671fa744d500d27f Mon Sep 17 00:00:00 2001 From: Marc-André Lureau Date: Tue, 10 Feb 2009 23:48:37 +0200 Subject: 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. --- src/modules/bluetooth/module-bluetooth-device.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/modules/bluetooth') diff --git a/src/modules/bluetooth/module-bluetooth-device.c b/src/modules/bluetooth/module-bluetooth-device.c index fa9d6bf3..666dc6a7 100644 --- a/src/modules/bluetooth/module-bluetooth-device.c +++ b/src/modules/bluetooth/module-bluetooth-device.c @@ -1568,6 +1568,14 @@ static int card_set_profile(pa_card *c, pa_card_profile *new_profile) { } 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); if (u->sink || u->source) -- cgit