summaryrefslogtreecommitdiffstats
path: root/src/modules/bluetooth
diff options
context:
space:
mode:
authorLuiz Augusto von Dentz <luiz.dentz-von@nokia.com>2011-04-29 17:48:05 +0300
committerColin Guthrie <colin@mageia.org>2011-04-30 14:26:45 +0100
commit95422110ba2492d1e8b466b3bc0592eaa8b895ec (patch)
tree8d9e9a5d3039679297e95a6b4d8b9b74481d57da /src/modules/bluetooth
parentadb16f9ff42008c5b8f76133d8879fc15a82533f (diff)
bluetooth: Fix not updating sample spec when using Media API
When using transport configured via Media API sample spec needs to be updated since codec configuration may affect it when e.g. headset configure a different frequency or number of channels from default.
Diffstat (limited to 'src/modules/bluetooth')
-rw-r--r--src/modules/bluetooth/module-bluetooth-device.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/modules/bluetooth/module-bluetooth-device.c b/src/modules/bluetooth/module-bluetooth-device.c
index bbd57ed4..6d2679dd 100644
--- a/src/modules/bluetooth/module-bluetooth-device.c
+++ b/src/modules/bluetooth/module-bluetooth-device.c
@@ -2156,6 +2156,8 @@ static int bt_transport_config_a2dp(struct userdata *u) {
config = (a2dp_sbc_t *) t->config;
+ u->sample_spec.format = PA_SAMPLE_S16LE;
+
if (a2dp->sbc_initialized)
sbc_reinit(&a2dp->sbc, 0);
else
@@ -2165,15 +2167,19 @@ static int bt_transport_config_a2dp(struct userdata *u) {
switch (config->frequency) {
case BT_SBC_SAMPLING_FREQ_16000:
a2dp->sbc.frequency = SBC_FREQ_16000;
+ u->sample_spec.rate = 16000U;
break;
case BT_SBC_SAMPLING_FREQ_32000:
a2dp->sbc.frequency = SBC_FREQ_32000;
+ u->sample_spec.rate = 32000U;
break;
case BT_SBC_SAMPLING_FREQ_44100:
a2dp->sbc.frequency = SBC_FREQ_44100;
+ u->sample_spec.rate = 44100U;
break;
case BT_SBC_SAMPLING_FREQ_48000:
a2dp->sbc.frequency = SBC_FREQ_48000;
+ u->sample_spec.rate = 48000U;
break;
default:
pa_assert_not_reached();
@@ -2182,15 +2188,19 @@ static int bt_transport_config_a2dp(struct userdata *u) {
switch (config->channel_mode) {
case BT_A2DP_CHANNEL_MODE_MONO:
a2dp->sbc.mode = SBC_MODE_MONO;
+ u->sample_spec.channels = 1;
break;
case BT_A2DP_CHANNEL_MODE_DUAL_CHANNEL:
a2dp->sbc.mode = SBC_MODE_DUAL_CHANNEL;
+ u->sample_spec.channels = 2;
break;
case BT_A2DP_CHANNEL_MODE_STEREO:
a2dp->sbc.mode = SBC_MODE_STEREO;
+ u->sample_spec.channels = 2;
break;
case BT_A2DP_CHANNEL_MODE_JOINT_STEREO:
a2dp->sbc.mode = SBC_MODE_JOINT_STEREO;
+ u->sample_spec.channels = 2;
break;
default:
pa_assert_not_reached();
@@ -2257,6 +2267,9 @@ static int bt_transport_config_a2dp(struct userdata *u) {
static int bt_transport_config(struct userdata *u) {
if (u->profile == PROFILE_HSP || u->profile == PROFILE_HFGW) {
u->block_size = u->link_mtu;
+ u->sample_spec.format = PA_SAMPLE_S16LE;
+ u->sample_spec.channels = 1;
+ u->sample_spec.rate = 8000;
return 0;
}