Loading system/stack/avdt/avdt_ad.cc +5 −10 Original line number Diff line number Diff line Loading @@ -193,14 +193,11 @@ AvdtpTransportChannel* avdt_ad_tc_tbl_by_st(uint8_t type, AvdtpCcb* p_ccb, * ******************************************************************************/ AvdtpTransportChannel* avdt_ad_tc_tbl_by_lcid(uint16_t lcid) { uint8_t idx; idx = avdtp_cb.ad.lcid_tbl[lcid - L2CAP_BASE_APPL_CID]; if (idx < AVDT_NUM_TC_TBL) { if (avdtp_cb.ad.lcid_tbl.count(lcid) != 0) { uint8_t idx = avdtp_cb.ad.lcid_tbl[lcid]; return &avdtp_cb.ad.tc_tbl[idx]; } else { return NULL; return nullptr; } } Loading Loading @@ -553,10 +550,8 @@ void avdt_ad_open_req(uint8_t type, AvdtpCcb* p_ccb, AvdtpScb* p_scb, L2CA_ConnectReq2(AVDT_PSM, p_ccb->peer_addr, BTM_SEC_OUT_AUTHENTICATE); if (lcid != 0) { /* if connect req ok, store tcid in lcid table */ avdtp_cb.ad.lcid_tbl[lcid - L2CAP_BASE_APPL_CID] = avdt_ad_tc_tbl_to_idx(p_tbl); AVDT_TRACE_DEBUG("avdtp_cb.ad.lcid_tbl[%d] = %d", (lcid - L2CAP_BASE_APPL_CID), avdtp_cb.ad.lcid_tbl[lcid] = avdt_ad_tc_tbl_to_idx(p_tbl); AVDT_TRACE_DEBUG("avdtp_cb.ad.lcid_tbl[%d] = %d", (lcid), avdt_ad_tc_tbl_to_idx(p_tbl)); avdtp_cb.ad.rt_tbl[avdt_ccb_to_idx(p_ccb)][p_tbl->tcid].lcid = lcid; Loading system/stack/avdt/avdt_int.h +6 −3 Original line number Diff line number Diff line Loading @@ -24,6 +24,8 @@ #ifndef AVDT_INT_H #define AVDT_INT_H #include <unordered_map> #include "avdt_api.h" #include "avdt_defs.h" #include "avdtc_api.h" Loading Loading @@ -686,7 +688,7 @@ class AvdtpRoutingEntry { */ class AvdtpAdaptationLayer { public: AvdtpAdaptationLayer() : lcid_tbl{} {} AvdtpAdaptationLayer() {} void Reset() { for (size_t i = 0; i < AVDT_NUM_LINKS; i++) { Loading @@ -697,7 +699,7 @@ class AvdtpAdaptationLayer { for (size_t i = 0; i < AVDT_NUM_TC_TBL; i++) { tc_tbl[i].Reset(); } memset(lcid_tbl, 0, sizeof(lcid_tbl)); lcid_tbl.clear(); } /** Loading @@ -711,7 +713,8 @@ class AvdtpAdaptationLayer { AvdtpRoutingEntry rt_tbl[AVDT_NUM_LINKS][AVDT_NUM_RT_TBL]; AvdtpTransportChannel tc_tbl[AVDT_NUM_TC_TBL]; uint8_t lcid_tbl[MAX_L2CAP_CHANNELS]; // Map LCID to tc_tbl index std::unordered_map<uint16_t, uint8_t> lcid_tbl; // Map LCID to tc_tbl index }; /** Loading system/stack/avdt/avdt_l2c.cc +2 −4 Original line number Diff line number Diff line Loading @@ -77,8 +77,7 @@ static void avdt_sec_check_complete_term(const RawAddress* bd_addr, if (p_tbl == NULL) return; /* store idx in LCID table, store LCID in routing table */ avdtp_cb.ad.lcid_tbl[p_tbl->lcid - L2CAP_BASE_APPL_CID] = avdt_ad_tc_tbl_to_idx(p_tbl); avdtp_cb.ad.lcid_tbl[p_tbl->lcid] = avdt_ad_tc_tbl_to_idx(p_tbl); avdtp_cb.ad.rt_tbl[avdt_ccb_to_idx(p_ccb)][p_tbl->tcid].lcid = p_tbl->lcid; /* transition to configuration state */ Loading Loading @@ -204,8 +203,7 @@ void avdt_l2c_connect_ind_cback(const RawAddress& bd_addr, uint16_t lcid, /* if result ok, proceed with connection */ /* store idx in LCID table, store LCID in routing table */ avdtp_cb.ad.lcid_tbl[lcid - L2CAP_BASE_APPL_CID] = avdt_ad_tc_tbl_to_idx(p_tbl); avdtp_cb.ad.lcid_tbl[lcid] = avdt_ad_tc_tbl_to_idx(p_tbl); avdtp_cb.ad.rt_tbl[avdt_ccb_to_idx(p_ccb)][p_tbl->tcid].lcid = lcid; /* transition to configuration state */ Loading Loading
system/stack/avdt/avdt_ad.cc +5 −10 Original line number Diff line number Diff line Loading @@ -193,14 +193,11 @@ AvdtpTransportChannel* avdt_ad_tc_tbl_by_st(uint8_t type, AvdtpCcb* p_ccb, * ******************************************************************************/ AvdtpTransportChannel* avdt_ad_tc_tbl_by_lcid(uint16_t lcid) { uint8_t idx; idx = avdtp_cb.ad.lcid_tbl[lcid - L2CAP_BASE_APPL_CID]; if (idx < AVDT_NUM_TC_TBL) { if (avdtp_cb.ad.lcid_tbl.count(lcid) != 0) { uint8_t idx = avdtp_cb.ad.lcid_tbl[lcid]; return &avdtp_cb.ad.tc_tbl[idx]; } else { return NULL; return nullptr; } } Loading Loading @@ -553,10 +550,8 @@ void avdt_ad_open_req(uint8_t type, AvdtpCcb* p_ccb, AvdtpScb* p_scb, L2CA_ConnectReq2(AVDT_PSM, p_ccb->peer_addr, BTM_SEC_OUT_AUTHENTICATE); if (lcid != 0) { /* if connect req ok, store tcid in lcid table */ avdtp_cb.ad.lcid_tbl[lcid - L2CAP_BASE_APPL_CID] = avdt_ad_tc_tbl_to_idx(p_tbl); AVDT_TRACE_DEBUG("avdtp_cb.ad.lcid_tbl[%d] = %d", (lcid - L2CAP_BASE_APPL_CID), avdtp_cb.ad.lcid_tbl[lcid] = avdt_ad_tc_tbl_to_idx(p_tbl); AVDT_TRACE_DEBUG("avdtp_cb.ad.lcid_tbl[%d] = %d", (lcid), avdt_ad_tc_tbl_to_idx(p_tbl)); avdtp_cb.ad.rt_tbl[avdt_ccb_to_idx(p_ccb)][p_tbl->tcid].lcid = lcid; Loading
system/stack/avdt/avdt_int.h +6 −3 Original line number Diff line number Diff line Loading @@ -24,6 +24,8 @@ #ifndef AVDT_INT_H #define AVDT_INT_H #include <unordered_map> #include "avdt_api.h" #include "avdt_defs.h" #include "avdtc_api.h" Loading Loading @@ -686,7 +688,7 @@ class AvdtpRoutingEntry { */ class AvdtpAdaptationLayer { public: AvdtpAdaptationLayer() : lcid_tbl{} {} AvdtpAdaptationLayer() {} void Reset() { for (size_t i = 0; i < AVDT_NUM_LINKS; i++) { Loading @@ -697,7 +699,7 @@ class AvdtpAdaptationLayer { for (size_t i = 0; i < AVDT_NUM_TC_TBL; i++) { tc_tbl[i].Reset(); } memset(lcid_tbl, 0, sizeof(lcid_tbl)); lcid_tbl.clear(); } /** Loading @@ -711,7 +713,8 @@ class AvdtpAdaptationLayer { AvdtpRoutingEntry rt_tbl[AVDT_NUM_LINKS][AVDT_NUM_RT_TBL]; AvdtpTransportChannel tc_tbl[AVDT_NUM_TC_TBL]; uint8_t lcid_tbl[MAX_L2CAP_CHANNELS]; // Map LCID to tc_tbl index std::unordered_map<uint16_t, uint8_t> lcid_tbl; // Map LCID to tc_tbl index }; /** Loading
system/stack/avdt/avdt_l2c.cc +2 −4 Original line number Diff line number Diff line Loading @@ -77,8 +77,7 @@ static void avdt_sec_check_complete_term(const RawAddress* bd_addr, if (p_tbl == NULL) return; /* store idx in LCID table, store LCID in routing table */ avdtp_cb.ad.lcid_tbl[p_tbl->lcid - L2CAP_BASE_APPL_CID] = avdt_ad_tc_tbl_to_idx(p_tbl); avdtp_cb.ad.lcid_tbl[p_tbl->lcid] = avdt_ad_tc_tbl_to_idx(p_tbl); avdtp_cb.ad.rt_tbl[avdt_ccb_to_idx(p_ccb)][p_tbl->tcid].lcid = p_tbl->lcid; /* transition to configuration state */ Loading Loading @@ -204,8 +203,7 @@ void avdt_l2c_connect_ind_cback(const RawAddress& bd_addr, uint16_t lcid, /* if result ok, proceed with connection */ /* store idx in LCID table, store LCID in routing table */ avdtp_cb.ad.lcid_tbl[lcid - L2CAP_BASE_APPL_CID] = avdt_ad_tc_tbl_to_idx(p_tbl); avdtp_cb.ad.lcid_tbl[lcid] = avdt_ad_tc_tbl_to_idx(p_tbl); avdtp_cb.ad.rt_tbl[avdt_ccb_to_idx(p_ccb)][p_tbl->tcid].lcid = lcid; /* transition to configuration state */ Loading