mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-01 18:50:34 +03:00
fix(bt): fix A2DP stack component issues reported by AI review
This commit is contained in:
@@ -66,6 +66,8 @@ static void a2d_sdp_cback(UINT16 status)
|
||||
|
||||
A2D_TRACE_API("a2d_sdp_cback status: %d", status);
|
||||
|
||||
memset(&a2d_svc, 0, sizeof(tA2D_Service));
|
||||
|
||||
if (status == SDP_SUCCESS) {
|
||||
/* loop through all records we found */
|
||||
do {
|
||||
@@ -74,7 +76,6 @@ static void a2d_sdp_cback(UINT16 status)
|
||||
a2d_cb.find.service_uuid, p_rec)) == NULL) {
|
||||
break;
|
||||
}
|
||||
memset(&a2d_svc, 0, sizeof(tA2D_Service));
|
||||
|
||||
/* get service name */
|
||||
if ((p_attr = SDP_FindAttributeInRec(p_rec,
|
||||
|
||||
@@ -107,14 +107,15 @@ tA2D_STATUS A2D_ParsSbcInfo(tA2D_SBC_CIE *p_ie, UINT8 *p_info, BOOLEAN for_caps)
|
||||
{
|
||||
tA2D_STATUS status = A2D_SUCCESS;
|
||||
UINT8 losc;
|
||||
UINT8 media_type;
|
||||
|
||||
if ( p_ie == NULL || p_info == NULL) {
|
||||
status = A2D_INVALID_PARAMS;
|
||||
} else {
|
||||
losc = *p_info++;
|
||||
p_info++;
|
||||
media_type = *p_info++;
|
||||
/* If the function is called for the wrong Media Type or Media Codec Type */
|
||||
if (losc != A2D_SBC_INFO_LEN || *p_info != A2D_MEDIA_CT_SBC) {
|
||||
if (losc != A2D_SBC_INFO_LEN || media_type != A2D_MEDIA_TYPE_AUDIO || *p_info != A2D_MEDIA_CT_SBC) {
|
||||
status = A2D_WRONG_CODEC;
|
||||
} else {
|
||||
p_info++;
|
||||
@@ -129,14 +130,10 @@ tA2D_STATUS A2D_ParsSbcInfo(tA2D_SBC_CIE *p_ie, UINT8 *p_info, BOOLEAN for_caps)
|
||||
p_ie->max_bitpool = *p_info;
|
||||
if (p_ie->min_bitpool < A2D_SBC_IE_MIN_BITPOOL || p_ie->min_bitpool > A2D_SBC_IE_MAX_BITPOOL ) {
|
||||
status = A2D_BAD_MIN_BITPOOL;
|
||||
}
|
||||
|
||||
if (p_ie->max_bitpool < A2D_SBC_IE_MIN_BITPOOL || p_ie->max_bitpool > A2D_SBC_IE_MAX_BITPOOL ||
|
||||
p_ie->max_bitpool < p_ie->min_bitpool) {
|
||||
} else if (p_ie->max_bitpool < A2D_SBC_IE_MIN_BITPOOL || p_ie->max_bitpool > A2D_SBC_IE_MAX_BITPOOL ||
|
||||
p_ie->max_bitpool < p_ie->min_bitpool) {
|
||||
status = A2D_BAD_MAX_BITPOOL;
|
||||
}
|
||||
|
||||
if (for_caps == FALSE) {
|
||||
} else if (for_caps == FALSE) {
|
||||
if (A2D_BitsSet(p_ie->samp_freq) != A2D_SET_ONE_BIT) {
|
||||
status = A2D_BAD_SAMP_FREQ;
|
||||
} else if (A2D_BitsSet(p_ie->ch_mode) != A2D_SET_ONE_BIT) {
|
||||
|
||||
Reference in New Issue
Block a user