summaryrefslogtreecommitdiffstats
path: root/src/modules/bluetooth
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@gmail.com>2009-02-10 23:48:37 +0200
committerMarc-André Lureau <marcandre.lureau@gmail.com>2009-02-10 23:53:36 +0200
commitcce4359831b5ff02f63e9748671fa744d500d27f (patch)
tree65f224d3cc425a70c81002e0e21316317ff4880c /src/modules/bluetooth
parentcac0f9ef2b91462778600821f456248efffb2517 (diff)
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.
Diffstat (limited to 'src/modules/bluetooth')
-rw-r--r--src/modules/bluetooth/module-bluetooth-device.c8
1 files changed, 8 insertions, 0 deletions
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)