[pulseaudio-discuss] [RFC 10/12] bluetooth: configure device based on selected transport

Pierre-Louis Bossart pierre-louis.bossart at linux.intel.com
Wed Feb 8 12:13:03 PST 2012


> ---
>   src/modules/bluetooth/module-bluetooth-device.c |   58 +++++++++++++++++++---
>   1 files changed, 50 insertions(+), 8 deletions(-)
>
> diff --git a/src/modules/bluetooth/module-bluetooth-device.c b/src/modules/bluetooth/module-bluetooth-device.c
> index 248460f..a1e37bd 100644
> --- a/src/modules/bluetooth/module-bluetooth-device.c
> +++ b/src/modules/bluetooth/module-bluetooth-device.c
> @@ -3021,7 +3021,6 @@ static int bt_transport_config_a2dp_sbc(struct userdata *u) {
>
>   static int bt_transport_config_a2dp_mpeg(struct userdata *u) {
>       const pa_bluetooth_transport *t;
> -    struct a2dp_info *a2dp =&u->a2dp;
>       a2dp_mpeg_t *config;
>
>       t = pa_bluetooth_discovery_get_transport(u->discovery, u->transport);
> @@ -3029,14 +3028,54 @@ static int bt_transport_config_a2dp_mpeg(struct userdata *u) {
>
>       config = (a2dp_mpeg_t *) t->config;
>
> -    return 0;
> -}
> +    u->sample_spec.format = PA_SAMPLE_S16LE;
>
> -static int bt_transport_config_a2dp(struct userdata *u) {
> -    if (u->a2dp.mode == A2DP_MODE_MPEG)
> -        return bt_transport_config_a2dp_mpeg(u);
> +    switch (config->frequency) {
> +        case BT_MPEG_SAMPLING_FREQ_16000:
> +            u->sample_spec.rate = 16000U;
> +            break;
> +        case BT_MPEG_SAMPLING_FREQ_22050:
> +            u->sample_spec.rate = 22050U;
> +            break;
> +        case BT_MPEG_SAMPLING_FREQ_24000:
> +            u->sample_spec.rate = 24000U;
> +            break;
> +        case BT_MPEG_SAMPLING_FREQ_32000:
> +            u->sample_spec.rate = 32000U;
> +            break;
> +        case BT_MPEG_SAMPLING_FREQ_44100:
> +            u->sample_spec.rate = 44100U;
> +            break;
> +        case BT_MPEG_SAMPLING_FREQ_48000:
> +            u->sample_spec.rate = 48000U;

This is inconsistent with the other patches. Not all those frequencies 
are supported in A2DP, and only 44.1 and 48kHz are used in the code. 
Either we support everything allowed by the standard, or we only support 
44.1 or 48kHz (my preference)
> +    u->block_size = 1152*4;
> +    u->leftover_bytes = 0;
>
This is true only for 32kHz and above. We should really stick to 44.1 
and 48kHz.


More information about the pulseaudio-discuss mailing list