Bthost Changes Configurable bits per sample support on split A2DP
Added bits_per_sample for all codec parser.
Change-Id: I45d002c28df43f71ea32111ad048810294b215dd
diff --git a/bthost_ipc/bthost_ipc.c b/bthost_ipc/bthost_ipc.c
index 7691ecf..660f8f7 100644
--- a/bthost_ipc/bthost_ipc.c
+++ b/bthost_ipc/bthost_ipc.c
@@ -286,11 +286,12 @@
sbc_codec.bitrate |= (*p_cfg++ << 8);
sbc_codec.bitrate |= (*p_cfg++ << 16);
sbc_codec.bitrate |= (*p_cfg++ << 24);
+ sbc_codec.bits_per_sample = *(uint32_t *)p_cfg;
*codec_type = AUDIO_FORMAT_SBC;
if(sample_freq) *sample_freq = sbc_codec.sampling_rate;
- ALOGW("SBC: Done copying full codec config");
+ ALOGW("SBC: Done copying full codec config bits_per_sample : %d", sbc_codec.bits_per_sample);
return ((void *)(&sbc_codec));
} else if (codec_cfg[CODEC_OFFSET] == CODEC_TYPE_AAC)
{
@@ -385,11 +386,11 @@
aac_bit_rate |= 0x000000FF & (((uint32_t)byte));
aac_codec.bitrate = aac_bit_rate;
-
+ aac_codec.bits_per_sample = *(uint32_t *)p_cfg;
*codec_type = AUDIO_FORMAT_AAC;
if(sample_freq) *sample_freq = aac_codec.sampling_rate;
- ALOGW("AAC: Done copying full codec config");
+ ALOGW("AAC: Done copying full codec config bits_per_sample : %d", aac_codec.bits_per_sample);
return ((void *)(&aac_codec));
}
else if (codec_cfg[CODEC_OFFSET] == NON_A2DP_CODEC_TYPE)
@@ -571,9 +572,9 @@
aptx_codec.bitrate |= (*p_cfg++ << 8);
aptx_codec.bitrate |= (*p_cfg++ << 16);
aptx_codec.bitrate |= (*p_cfg++ << 24);
-
+ aptx_codec.bits_per_sample = *(uint32_t *)p_cfg;
if(sample_freq) *sample_freq = aptx_codec.sampling_rate;
- ALOGW("APTx: Done copying full codec config");
+ ALOGW("APTx: Done copying full codec config bits_per_sample : %d", aptx_codec.bits_per_sample);
if (*codec_type == ENC_CODEC_TYPE_APTX_DUAL_MONO)
{
memset(&aptx_tws_codec, 0, sizeof(audio_aptx_tws_encoder_config_t));
@@ -1629,8 +1630,8 @@
ldac_codec.bitrate |= (*p_cfg++ << 24);
ldac_codec.is_abr_enabled = (ldac_codec.bitrate == 0);
-
- ALOGW("Create Lookup for %d with ABR %d", ldac_codec.sampling_rate, ldac_codec.is_abr_enabled);
+ ldac_codec.bits_per_sample = *(uint32_t *)p_cfg;
+ ALOGW("Create Lookup for %d with ABR %d, bits_per_sample %d", ldac_codec.sampling_rate, ldac_codec.is_abr_enabled, ldac_codec.bits_per_sample);
if (ldac_codec.sampling_rate == 44100 ||
ldac_codec.sampling_rate == 88200) {
int num_of_level_entries =
diff --git a/bthost_ipc/bthost_ipc.h b/bthost_ipc/bthost_ipc.h
index 5d81bbf..64209be 100644
--- a/bthost_ipc/bthost_ipc.h
+++ b/bthost_ipc/bthost_ipc.h
@@ -278,6 +278,7 @@
uint8_t min_bitpool; /* 2 */
uint8_t max_bitpool; /*53(44.1khz),51 (48khz) */
uint32_t bitrate; /* 320kbps to 512kbps */
+ uint32_t bits_per_sample;
} audio_sbc_encoder_config_t;
@@ -289,6 +290,7 @@
uint16_t sampling_rate;
uint8_t channels;
uint32_t bitrate;
+ uint32_t bits_per_sample;
} audio_aptx_encoder_config_t;
/* Information about BT APTX Adaptive encoder
@@ -345,6 +347,7 @@
uint16_t mtu;
bool is_abr_enabled;
struct quality_level_to_bitrate_info level_to_bitrate_map;
+ uint32_t bits_per_sample;
} audio_ldac_encoder_config_t;
/* Information about BT AAC encoder configuration
@@ -357,6 +360,7 @@
uint16_t channels; /* 1-Mono, 2-Stereo */
uint32_t sampling_rate;
uint32_t bitrate;
+ uint32_t bits_per_sample;
} audio_aac_encoder_config_t;
typedef struct {