mirror of
https://github.com/Divested-Mobile/DivestOS-Build.git
synced 2024-12-13 09:54:36 -05:00
b5bc269743
Signed-off-by: Tad <tad@spotco.us>
65 lines
2.2 KiB
Diff
65 lines
2.2 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: ValdikSS <iam@valdikss.org.ru>
|
|
Date: Thu, 13 Sep 2018 23:14:10 +0300
|
|
Subject: [PATCH] Allow using alternative (higher) SBC HD bitrates with a
|
|
property
|
|
|
|
Change-Id: Ic85e5c8a8c70233de2125e69c01d74e5501a2da8
|
|
---
|
|
stack/a2dp/a2dp_sbc_encoder.cc | 21 +++++++++++++++++++++
|
|
1 file changed, 21 insertions(+)
|
|
|
|
diff --git a/stack/a2dp/a2dp_sbc_encoder.cc b/stack/a2dp/a2dp_sbc_encoder.cc
|
|
index d80f1b680..5cf1ac104 100644
|
|
--- a/stack/a2dp/a2dp_sbc_encoder.cc
|
|
+++ b/stack/a2dp/a2dp_sbc_encoder.cc
|
|
@@ -32,6 +32,7 @@
|
|
#include "embdrv/sbc/encoder/include/sbc_encoder.h"
|
|
#include "osi/include/log.h"
|
|
#include "osi/include/osi.h"
|
|
+#include "osi/include/properties.h"
|
|
|
|
/* Buffer pool */
|
|
#define A2DP_SBC_BUFFER_SIZE BT_DEFAULT_BUFFER_SIZE
|
|
@@ -54,6 +55,17 @@
|
|
#define A2DP_SBC_3DH5_DEFAULT_BITRATE 552
|
|
#define A2DP_SBC_3DH5_48KHZ_BITRATE 601
|
|
|
|
+/*
|
|
+ * SBC Dual Channel (SBC HD) 2DH5 alternative bitrates.
|
|
+ * 648 kbps @ 48 khz, 595.4 kbps @ 44.1 khz.
|
|
+ * Up to 3 frames for 2DH5.
|
|
+ */
|
|
+#define A2DP_SBC_2DH5_ALT_BITRATE 596
|
|
+#define A2DP_SBC_2DH5_ALT_48KHZ_BITRATE 649
|
|
+
|
|
+// SBC HD alternative bitrate property
|
|
+#define A2DP_SBC_HD_PROP "persist.bluetooth.sbc_hd_higher_bitrate"
|
|
+
|
|
#define A2DP_SBC_NON_EDR_MAX_RATE 229
|
|
|
|
/*
|
|
@@ -853,6 +865,7 @@ static uint16_t a2dp_sbc_source_rate() {
|
|
if (a2dp_sbc_encoder_cb.sbc_encoder_params.s16SamplingFreq == SBC_sf48000)
|
|
rate = A2DP_SBC_48KHZ_BITRATE;
|
|
|
|
+ /* 3DH5 maximum bitrates */
|
|
if (a2dp_sbc_encoder_cb.peer_supports_3mbps &&
|
|
a2dp_sbc_encoder_cb.TxAaMtuSize >= MIN_3MBPS_AVDTP_SAFE_MTU) {
|
|
rate = A2DP_SBC_3DH5_DEFAULT_BITRATE;
|
|
@@ -860,6 +873,14 @@ static uint16_t a2dp_sbc_source_rate() {
|
|
rate = A2DP_SBC_3DH5_48KHZ_BITRATE;
|
|
}
|
|
|
|
+ /* 2DH5 alternative bitrates */
|
|
+ if (!a2dp_sbc_encoder_cb.peer_supports_3mbps &&
|
|
+ osi_property_get_int32(A2DP_SBC_HD_PROP, 0)) {
|
|
+ rate = A2DP_SBC_2DH5_ALT_BITRATE;
|
|
+ if (a2dp_sbc_encoder_cb.sbc_encoder_params.s16SamplingFreq == SBC_sf48000)
|
|
+ rate = A2DP_SBC_2DH5_ALT_48KHZ_BITRATE;
|
|
+ }
|
|
+
|
|
/* restrict bitrate if a2dp link is non-edr */
|
|
if (!a2dp_sbc_encoder_cb.is_peer_edr) {
|
|
rate = A2DP_SBC_NON_EDR_MAX_RATE;
|