From e61f571e2209fcbd154eb9110431cf04561491cc Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Thu, 7 Jan 2021 14:58:29 +0100 Subject: [PATCH] Revert "Update of a2dp-codec-sbc.c to achieve SBC XQ quality in dual channel, with fall back to standard Joint Stereo mode" This reverts commit 4e1cbef68701ea914a74e6e3fea607fc9e351841. This needs some more work --- spa/plugins/bluez5/a2dp-codec-sbc.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/spa/plugins/bluez5/a2dp-codec-sbc.c b/spa/plugins/bluez5/a2dp-codec-sbc.c index 9e228224a..f5b6998ac 100644 --- a/spa/plugins/bluez5/a2dp-codec-sbc.c +++ b/spa/plugins/bluez5/a2dp-codec-sbc.c @@ -85,8 +85,7 @@ static int codec_fill_caps(const struct a2dp_codec *codec, uint32_t flags, static uint8_t default_bitpool(uint8_t freq, uint8_t mode) { - /* A2DP spec v1.2 states that all SNK implementation shall handle bitrates - of up to 512 kbps (~ bitpool = 76 stereo, or 2x38 dual channel). */ + /* These bitpool values were chosen based on the A2DP spec recommendation */ switch (freq) { case SBC_SAMPLING_FREQ_16000: case SBC_SAMPLING_FREQ_32000: @@ -96,22 +95,22 @@ static uint8_t default_bitpool(uint8_t freq, uint8_t mode) switch (mode) { case SBC_CHANNEL_MODE_MONO: case SBC_CHANNEL_MODE_DUAL_CHANNEL: - return 38; + return 31; case SBC_CHANNEL_MODE_STEREO: case SBC_CHANNEL_MODE_JOINT_STEREO: - return 64; + return 53; } return 53; case SBC_SAMPLING_FREQ_48000: switch (mode) { case SBC_CHANNEL_MODE_MONO: case SBC_CHANNEL_MODE_DUAL_CHANNEL: - return 35; + return 29; case SBC_CHANNEL_MODE_STEREO: case SBC_CHANNEL_MODE_JOINT_STEREO: - return 62; + return 51; } return 51; } @@ -141,12 +140,12 @@ static int codec_select_config(const struct a2dp_codec *codec, uint32_t flags, else return -ENOTSUP; - if (conf.channel_mode & SBC_CHANNEL_MODE_DUAL_CHANNEL) - conf.channel_mode = SBC_CHANNEL_MODE_DUAL_CHANNEL; - else if (conf.channel_mode & SBC_CHANNEL_MODE_JOINT_STEREO) + if (conf.channel_mode & SBC_CHANNEL_MODE_JOINT_STEREO) conf.channel_mode = SBC_CHANNEL_MODE_JOINT_STEREO; else if (conf.channel_mode & SBC_CHANNEL_MODE_STEREO) conf.channel_mode = SBC_CHANNEL_MODE_STEREO; + else if (conf.channel_mode & SBC_CHANNEL_MODE_DUAL_CHANNEL) + conf.channel_mode = SBC_CHANNEL_MODE_DUAL_CHANNEL; else if (conf.channel_mode & SBC_CHANNEL_MODE_MONO) conf.channel_mode = SBC_CHANNEL_MODE_MONO; else