Loading system/bta/av/bta_av_aact.cc +39 −11 Original line number Diff line number Diff line Loading @@ -1095,6 +1095,10 @@ void bta_av_config_ind(tBTA_AV_SCB* p_scb, tBTA_AV_DATA* p_data) { local_sep = bta_av_get_scb_sep_type(p_scb, p_msg->handle); p_scb->avdt_label = p_data->str_msg.msg.hdr.label; APPL_TRACE_DEBUG("%s: local_sep = %d", __func__, local_sep); A2DP_DumpCodecInfo(p_evt_cfg->codec_info); memcpy(p_scb->cfg.codec_info, p_evt_cfg->codec_info, AVDT_CODEC_SIZE); bta_av_save_addr(p_scb, p_data->str_msg.bd_addr); Loading Loading @@ -1452,6 +1456,8 @@ void bta_av_security_cfm(tBTA_AV_SCB* p_scb, tBTA_AV_DATA* p_data) { * ******************************************************************************/ void bta_av_do_close(tBTA_AV_SCB* p_scb, UNUSED_ATTR tBTA_AV_DATA* p_data) { APPL_TRACE_DEBUG("%s: p_scb->co_started=%d", __func__, p_scb->co_started); /* stop stream if started */ if (p_scb->co_started) { bta_av_str_stopped(p_scb, NULL); Loading Loading @@ -1630,12 +1636,18 @@ void bta_av_save_caps(tBTA_AV_SCB* p_scb, tBTA_AV_DATA* p_data) { APPL_TRACE_DEBUG("%s: num_seps:%d sep_info_idx:%d wait:x%x", __func__, p_scb->num_seps, p_scb->sep_info_idx, p_scb->wait); A2DP_DumpCodecInfo(p_scb->p_cap->codec_info); memcpy(&cfg, p_scb->p_cap, sizeof(tAVDT_CFG)); /* let application know the capability of the SNK */ p_scb->p_cos->getcfg(p_scb->hndl, cfg.codec_info, &p_scb->sep_info_idx, p_info->seid, &cfg.num_protect, cfg.protect_info); p_scb->sep_info_idx++; APPL_TRACE_DEBUG("%s: result: sep_info_idx:%d", __func__, p_scb->sep_info_idx); A2DP_DumpCodecInfo(cfg.codec_info); if (p_scb->num_seps > p_scb->sep_info_idx) { /* Some devices have seps at the end of the discover list, which is not */ /* matching media type(video not audio). */ Loading @@ -1646,8 +1658,9 @@ void bta_av_save_caps(tBTA_AV_SCB* p_scb, tBTA_AV_DATA* p_data) { getcap_done = true; if (getcap_done) { /* we are done getting capabilities. restore the p_cb->sep_info_idx */ p_scb->sep_info_idx = 0; APPL_TRACE_DEBUG("%s: getcap_done: num_seps:%d sep_info_idx:%d wait:x%x", __func__, p_scb->num_seps, p_scb->sep_info_idx, p_scb->wait); p_scb->wait &= ~(BTA_AV_WAIT_ACP_CAPS_ON | BTA_AV_WAIT_ACP_CAPS_STARTED); if (old_wait & BTA_AV_WAIT_ACP_CAPS_STARTED) { bta_av_start_ok(p_scb, NULL); Loading Loading @@ -1765,6 +1778,7 @@ void bta_av_getcap_results(tBTA_AV_SCB* p_scb, tBTA_AV_DATA* p_data) { APPL_TRACE_DEBUG("%s: num_codec %d", __func__, p_scb->p_cap->num_codec); APPL_TRACE_DEBUG("%s: media type x%x, x%x", __func__, media_type, p_scb->media_type); A2DP_DumpCodecInfo(p_scb->cfg.codec_info); /* if codec present and we get a codec configuration */ if ((p_scb->p_cap->num_codec != 0) && (media_type == p_scb->media_type) && Loading @@ -1774,6 +1788,10 @@ void bta_av_getcap_results(tBTA_AV_SCB* p_scb, tBTA_AV_DATA* p_data) { /* save copy of codec configuration */ memcpy(&p_scb->cfg, &cfg, sizeof(tAVDT_CFG)); APPL_TRACE_DEBUG("%s: result: sep_info_idx=%d", __func__, p_scb->sep_info_idx); A2DP_DumpCodecInfo(p_scb->cfg.codec_info); uuid_int = p_scb->uuid_int; APPL_TRACE_DEBUG("%s: initiator UUID = 0x%x", __func__, uuid_int); if (uuid_int == UUID_SERVCLASS_AUDIO_SOURCE) Loading Loading @@ -2031,16 +2049,22 @@ void bta_av_reconfig(tBTA_AV_SCB* p_scb, tBTA_AV_DATA* p_data) { /* store the new configuration in control block */ if (p_scb->p_cap == NULL) p_scb->p_cap = (tAVDT_CFG*)osi_malloc(sizeof(tAVDT_CFG)); p_cfg = p_scb->p_cap; p_cfg = &p_scb->cfg; alarm_cancel(p_scb->avrc_ct_timer); memcpy(p_cfg, &p_scb->cfg, sizeof(tAVDT_CFG)); APPL_TRACE_DEBUG( "%s: p_scb->sep_info_idx=%d p_scb->rcfg_idx=%d p_rcfg->sep_info_idx=%d", __func__, p_scb->sep_info_idx, p_scb->rcfg_idx, p_rcfg->sep_info_idx); A2DP_DumpCodecInfo(p_scb->p_cap->codec_info); A2DP_DumpCodecInfo(p_scb->cfg.codec_info); A2DP_DumpCodecInfo(p_rcfg->codec_info); p_cfg->num_protect = p_rcfg->num_protect; memcpy(p_cfg->codec_info, p_rcfg->codec_info, AVDT_CODEC_SIZE); memcpy(p_cfg->protect_info, p_rcfg->p_protect_info, p_rcfg->num_protect); p_scb->rcfg_idx = p_rcfg->sep_info_idx; p_scb->p_cap->psc_mask = p_scb->cur_psc_mask; p_cfg->psc_mask = p_scb->cur_psc_mask; // If the requested SEP index is same as the current one, then we // can Suspend->Reconfigure->Start. Loading @@ -2057,8 +2081,9 @@ void bta_av_reconfig(tBTA_AV_SCB* p_scb, tBTA_AV_DATA* p_data) { } else { // Reconfigure APPL_TRACE_DEBUG("%s: reconfig", __func__); AVDT_ReconfigReq(p_scb->avdt_handle, p_scb->p_cap); p_scb->p_cap->psc_mask = p_scb->cur_psc_mask; A2DP_DumpCodecInfo(p_scb->cfg.codec_info); AVDT_ReconfigReq(p_scb->avdt_handle, &p_scb->cfg); p_scb->cfg.psc_mask = p_scb->cur_psc_mask; } } else { // Close the stream first, and then Configure it Loading Loading @@ -2726,8 +2751,9 @@ void bta_av_suspend_cont(tBTA_AV_SCB* p_scb, tBTA_AV_DATA* p_data) { APPL_TRACE_DEBUG("%s: calling AVDT_ReconfigReq", __func__); /* reconfig the stream */ AVDT_ReconfigReq(p_scb->avdt_handle, p_scb->p_cap); p_scb->p_cap->psc_mask = p_scb->cur_psc_mask; A2DP_DumpCodecInfo(p_scb->cfg.codec_info); AVDT_ReconfigReq(p_scb->avdt_handle, &p_scb->cfg); p_scb->cfg.psc_mask = p_scb->cur_psc_mask; } } Loading Loading @@ -2807,7 +2833,9 @@ void bta_av_rcfg_open(tBTA_AV_SCB* p_scb, UNUSED_ATTR tBTA_AV_DATA* p_data) { AVDT_DiscoverReq(p_scb->peer_addr, p_scb->sep_info, BTA_AV_NUM_SEPS, bta_av_dt_cback[p_scb->hdi]); } else { memcpy(p_scb->cfg.codec_info, p_scb->p_cap->codec_info, AVDT_CODEC_SIZE); APPL_TRACE_DEBUG("%s: calling AVDT_OpenReq()", __func__); A2DP_DumpCodecInfo(p_scb->cfg.codec_info); /* we may choose to use a different SEP at reconfig. * adjust the sep_idx now */ bta_av_adjust_seps_idx(p_scb, bta_av_get_scb_handle(p_scb, AVDT_TSEP_SRC)); Loading @@ -2815,7 +2843,7 @@ void bta_av_rcfg_open(tBTA_AV_SCB* p_scb, UNUSED_ATTR tBTA_AV_DATA* p_data) { /* open the stream with the new config */ p_scb->sep_info_idx = p_scb->rcfg_idx; AVDT_OpenReq(p_scb->avdt_handle, p_scb->peer_addr, p_scb->sep_info[p_scb->sep_info_idx].seid, p_scb->p_cap); p_scb->sep_info[p_scb->sep_info_idx].seid, &p_scb->cfg); } } Loading system/btif/co/bta_av_co.cc +31 −3 Original line number Diff line number Diff line Loading @@ -395,6 +395,7 @@ tA2DP_STATUS bta_av_co_audio_getconfig(tBTA_AV_HNDL hndl, uint8_t* p_codec_info, tBTA_AV_CO_PEER* p_peer; APPL_TRACE_DEBUG("%s", __func__); A2DP_DumpCodecInfo(p_codec_info); /* Retrieve the peer info */ p_peer = bta_av_co_get_peer(hndl); Loading Loading @@ -507,6 +508,7 @@ void bta_av_co_audio_setconfig(tBTA_AV_HNDL hndl, const uint8_t* p_codec_info, APPL_TRACE_DEBUG("num_protect:0x%02x protect_info:0x%02x%02x%02x", num_protect, p_protect_info[0], p_protect_info[1], p_protect_info[2]); A2DP_DumpCodecInfo(p_codec_info); /* Retrieve the peer info */ p_peer = bta_av_co_get_peer(hndl); Loading Loading @@ -992,6 +994,9 @@ static void bta_av_co_save_new_codec_config(tBTA_AV_CO_PEER* p_peer, const uint8_t* new_codec_config, uint8_t num_protect, const uint8_t* p_protect_info) { APPL_TRACE_DEBUG("%s", __func__); A2DP_DumpCodecInfo(new_codec_config); // Protect access to bta_av_co_cb.codec_config mutex_global_lock(); Loading Loading @@ -1114,6 +1119,15 @@ bool bta_av_co_set_codec_user_config( success = false; goto done; } // Don't call BTA_AvReconfig() prior to retrieving all peer's capabilities if ((p_peer->num_rx_sinks != p_peer->num_sinks) && (p_peer->num_sup_sinks != BTA_AV_CO_NUM_ELEMENTS(p_peer->sinks))) { APPL_TRACE_WARNING("%s: not all peer's capabilities have been retrieved", __func__); success = false; goto done; } APPL_TRACE_DEBUG("%s: call BTA_AvReconfig(x%x)", __func__, p_peer->handle); BTA_AvReconfig(p_peer->handle, true, p_sink->sep_info_idx, p_peer->codec_config, num_protect, bta_av_co_cp_scmst); Loading Loading @@ -1154,6 +1168,9 @@ static bool bta_av_co_set_codec_ota_config(tBTA_AV_CO_PEER* p_peer, bool restart_output = false; bool config_updated = false; APPL_TRACE_DEBUG("%s", __func__); A2DP_DumpCodecInfo(p_ota_codec_config); *p_restart_output = false; // Find the peer SEP codec to use Loading Loading @@ -1190,6 +1207,9 @@ static bool bta_av_co_set_codec_ota_config(tBTA_AV_CO_PEER* p_peer, } if (restart_output) { APPL_TRACE_DEBUG("%s: restart output", __func__); A2DP_DumpCodecInfo(result_codec_config); *p_restart_output = true; p_peer->p_sink = p_sink; bta_av_co_save_new_codec_config(p_peer, result_codec_config, num_protect, Loading Loading @@ -1249,10 +1269,18 @@ bool bta_av_co_set_codec_audio_config( bta_av_co_save_new_codec_config(p_peer, result_codec_config, p_sink->num_protect, p_sink->protect_info); APPL_TRACE_DEBUG("%s: call BTA_AvReconfig(x%x)", __func__, p_peer->handle); // Don't call BTA_AvReconfig() prior to retrieving all peer's capabilities if ((p_peer->num_rx_sinks != p_peer->num_sinks) && (p_peer->num_sup_sinks != BTA_AV_CO_NUM_ELEMENTS(p_peer->sinks))) { APPL_TRACE_WARNING("%s: not all peer's capabilities have been retrieved", __func__); } else { APPL_TRACE_DEBUG("%s: call BTA_AvReconfig(x%x)", __func__, p_peer->handle); BTA_AvReconfig(p_peer->handle, true, p_sink->sep_info_idx, p_peer->codec_config, num_protect, bta_av_co_cp_scmst); } } if (config_updated) { // NOTE: Currently, the input is restarted by sending an upcall Loading system/stack/avdt/avdt_api.cc +108 −4 Original line number Diff line number Diff line Loading @@ -32,6 +32,7 @@ #include "btm_api.h" #include "btu.h" #include "l2c_api.h" #include "stack/include/a2dp_codec_api.h" /* Control block for AVDT */ tAVDT_CB avdt_cb; Loading Loading @@ -135,7 +136,7 @@ void AVDT_Deregister(void) { } void AVDT_AbortReq(uint8_t handle) { AVDT_TRACE_ERROR("%s", __func__); AVDT_TRACE_WARNING("%s: handle=%d", __func__, handle); tAVDT_SCB* p_scb = avdt_scb_by_hdl(handle); if (p_scb != NULL) { Loading Loading @@ -163,6 +164,8 @@ uint16_t AVDT_CreateStream(uint8_t* p_handle, tAVDT_CS* p_cs) { uint16_t result = AVDT_SUCCESS; tAVDT_SCB* p_scb; AVDT_TRACE_DEBUG("%s", __func__); /* Verify parameters; if invalid, return failure */ if (((p_cs->cfg.psc_mask & (~AVDT_PSC)) != 0) || (p_cs->p_ctrl_cback == NULL)) { Loading @@ -177,6 +180,9 @@ uint16_t AVDT_CreateStream(uint8_t* p_handle, tAVDT_CS* p_cs) { *p_handle = avdt_scb_to_hdl(p_scb); } } AVDT_TRACE_DEBUG("%s: result=%d", __func__, result); return result; } Loading @@ -198,6 +204,8 @@ uint16_t AVDT_RemoveStream(uint8_t handle) { uint16_t result = AVDT_SUCCESS; tAVDT_SCB* p_scb; AVDT_TRACE_DEBUG("%s: handle=%d", __func__, handle); /* look up scb */ p_scb = avdt_scb_by_hdl(handle); if (p_scb == NULL) { Loading @@ -206,6 +214,9 @@ uint16_t AVDT_RemoveStream(uint8_t handle) { /* send remove event to scb */ avdt_scb_event(p_scb, AVDT_SCB_API_REMOVE_EVT, NULL); } AVDT_TRACE_DEBUG("%s: result=%d", __func__, result); return result; } Loading Loading @@ -241,6 +252,8 @@ uint16_t AVDT_DiscoverReq(const RawAddress& bd_addr, tAVDT_SEP_INFO* p_sep_info, uint16_t result = AVDT_SUCCESS; tAVDT_CCB_EVT evt; AVDT_TRACE_DEBUG("%s", __func__); /* find channel control block for this bd addr; if none, allocate one */ p_ccb = avdt_ccb_by_bd(bd_addr); if (p_ccb == NULL) { Loading @@ -264,6 +277,9 @@ uint16_t AVDT_DiscoverReq(const RawAddress& bd_addr, tAVDT_SEP_INFO* p_sep_info, avdt_ccb_event(p_ccb, AVDT_CCB_API_DISCOVER_REQ_EVT, &evt); } } AVDT_TRACE_DEBUG("%s: result=%d", __func__, result); return result; } Loading @@ -282,6 +298,8 @@ static uint16_t avdt_get_cap_req(const RawAddress& bd_addr, tAVDT_CCB* p_ccb = NULL; uint16_t result = AVDT_SUCCESS; AVDT_TRACE_DEBUG("%s", __func__); /* verify SEID */ if ((p_evt->single.seid < AVDT_SEID_MIN) || (p_evt->single.seid > AVDT_SEID_MAX)) { Loading Loading @@ -310,6 +328,9 @@ static uint16_t avdt_get_cap_req(const RawAddress& bd_addr, avdt_ccb_event(p_ccb, AVDT_CCB_API_GETCAP_REQ_EVT, (tAVDT_CCB_EVT*)p_evt); } } AVDT_TRACE_DEBUG("%s: result=%d", __func__, result); return result; } Loading Loading @@ -340,12 +361,19 @@ static uint16_t avdt_get_cap_req(const RawAddress& bd_addr, uint16_t AVDT_GetCapReq(const RawAddress& bd_addr, uint8_t seid, tAVDT_CFG* p_cfg, tAVDT_CTRL_CBACK* p_cback) { tAVDT_CCB_API_GETCAP getcap; uint16_t result = AVDT_SUCCESS; AVDT_TRACE_DEBUG("%s", __func__); getcap.single.seid = seid; getcap.single.sig_id = AVDT_SIG_GETCAP; getcap.p_cfg = p_cfg; getcap.p_cback = p_cback; return avdt_get_cap_req(bd_addr, &getcap); result = avdt_get_cap_req(bd_addr, &getcap); AVDT_TRACE_DEBUG("%s: result=%d", __func__, result); return result; } /******************************************************************************* Loading Loading @@ -375,12 +403,19 @@ uint16_t AVDT_GetCapReq(const RawAddress& bd_addr, uint8_t seid, uint16_t AVDT_GetAllCapReq(const RawAddress& bd_addr, uint8_t seid, tAVDT_CFG* p_cfg, tAVDT_CTRL_CBACK* p_cback) { tAVDT_CCB_API_GETCAP getcap; uint16_t result = AVDT_SUCCESS; AVDT_TRACE_DEBUG("%s", __func__); getcap.single.seid = seid; getcap.single.sig_id = AVDT_SIG_GET_ALLCAP; getcap.p_cfg = p_cfg; getcap.p_cback = p_cback; return avdt_get_cap_req(bd_addr, &getcap); result = avdt_get_cap_req(bd_addr, &getcap); AVDT_TRACE_DEBUG("%s: result=%d", __func__, result); return result; } /******************************************************************************* Loading @@ -399,6 +434,9 @@ uint16_t AVDT_DelayReport(uint8_t handle, uint8_t seid, uint16_t delay) { uint16_t result = AVDT_SUCCESS; tAVDT_SCB_EVT evt; AVDT_TRACE_DEBUG("%s: handle=%d ceid=%d delay=%d", __func__, handle, seid, delay); /* map handle to scb */ p_scb = avdt_scb_by_hdl(handle); if (p_scb == NULL) { Loading @@ -411,6 +449,8 @@ uint16_t AVDT_DelayReport(uint8_t handle, uint8_t seid, uint16_t delay) { avdt_scb_event(p_scb, AVDT_SCB_API_DELAY_RPT_REQ_EVT, &evt); } AVDT_TRACE_DEBUG("%s: result=%d", __func__, result); return result; } Loading @@ -435,6 +475,8 @@ uint16_t AVDT_OpenReq(uint8_t handle, const RawAddress& bd_addr, uint8_t seid, uint16_t result = AVDT_SUCCESS; tAVDT_SCB_EVT evt; AVDT_TRACE_DEBUG("%s: handle=%d seid=%d", __func__, handle, seid); /* verify SEID */ if ((seid < AVDT_SEID_MIN) || (seid > AVDT_SEID_MAX)) { result = AVDT_BAD_PARAMS; Loading @@ -460,12 +502,17 @@ uint16_t AVDT_OpenReq(uint8_t handle, const RawAddress& bd_addr, uint8_t seid, /* send event to scb */ if (result == AVDT_SUCCESS) { A2DP_DumpCodecInfo(p_cfg->codec_info); evt.msg.config_cmd.hdr.seid = seid; evt.msg.config_cmd.hdr.ccb_idx = avdt_ccb_to_idx(p_ccb); evt.msg.config_cmd.int_seid = handle; evt.msg.config_cmd.p_cfg = p_cfg; avdt_scb_event(p_scb, AVDT_SCB_API_SETCONFIG_REQ_EVT, &evt); } AVDT_TRACE_DEBUG("%s: result=%d", __func__, result); return result; } Loading @@ -488,6 +535,9 @@ uint16_t AVDT_ConfigRsp(uint8_t handle, uint8_t label, uint8_t error_code, uint16_t result = AVDT_SUCCESS; uint8_t event_code; AVDT_TRACE_DEBUG("%s: handle=%d label=%d error_code=%d category=%d", __func__, handle, label, error_code, category); /* map handle to scb */ p_scb = avdt_scb_by_hdl(handle); if (p_scb == NULL) { Loading @@ -512,6 +562,8 @@ uint16_t AVDT_ConfigRsp(uint8_t handle, uint8_t label, uint8_t error_code, avdt_scb_event(p_scb, event_code, &evt); } AVDT_TRACE_DEBUG("%s: result=%d", __func__, result); return result; } Loading @@ -536,6 +588,8 @@ uint16_t AVDT_StartReq(uint8_t* p_handles, uint8_t num_handles) { uint16_t result = AVDT_SUCCESS; int i; AVDT_TRACE_DEBUG("%s: num_handles=%d", __func__, num_handles); if ((num_handles == 0) || (num_handles > AVDT_NUM_SEPS)) { result = AVDT_BAD_PARAMS; } else { Loading @@ -559,6 +613,9 @@ uint16_t AVDT_StartReq(uint8_t* p_handles, uint8_t num_handles) { avdt_ccb_event(p_scb->p_ccb, AVDT_CCB_API_START_REQ_EVT, &evt); } } AVDT_TRACE_DEBUG("%s: result=%d", __func__, result); return result; } Loading @@ -583,6 +640,8 @@ uint16_t AVDT_SuspendReq(uint8_t* p_handles, uint8_t num_handles) { uint16_t result = AVDT_SUCCESS; int i; AVDT_TRACE_DEBUG("%s: num_handles=%d", __func__, num_handles); if ((num_handles == 0) || (num_handles > AVDT_NUM_SEPS)) { result = AVDT_BAD_PARAMS; } else { Loading @@ -607,6 +666,8 @@ uint16_t AVDT_SuspendReq(uint8_t* p_handles, uint8_t num_handles) { } } AVDT_TRACE_DEBUG("%s: result=%d", __func__, result); return result; } Loading @@ -628,6 +689,8 @@ uint16_t AVDT_CloseReq(uint8_t handle) { tAVDT_SCB* p_scb; uint16_t result = AVDT_SUCCESS; AVDT_TRACE_DEBUG("%s: handle=%d", __func__, handle); /* map handle to scb */ p_scb = avdt_scb_by_hdl(handle); if (p_scb == NULL) { Loading @@ -638,6 +701,8 @@ uint16_t AVDT_CloseReq(uint8_t handle) { avdt_scb_event(p_scb, AVDT_SCB_API_CLOSE_REQ_EVT, NULL); } AVDT_TRACE_DEBUG("%s: result=%d", __func__, result); return result; } Loading @@ -663,6 +728,8 @@ uint16_t AVDT_ReconfigReq(uint8_t handle, tAVDT_CFG* p_cfg) { uint16_t result = AVDT_SUCCESS; tAVDT_SCB_EVT evt; AVDT_TRACE_DEBUG("%s: handle=%d", __func__, handle); /* map handle to scb */ p_scb = avdt_scb_by_hdl(handle); if (p_scb == NULL) { Loading @@ -672,10 +739,12 @@ uint16_t AVDT_ReconfigReq(uint8_t handle, tAVDT_CFG* p_cfg) { else { /* force psc_mask to zero */ p_cfg->psc_mask = 0; evt.msg.reconfig_cmd.p_cfg = p_cfg; avdt_scb_event(p_scb, AVDT_SCB_API_RECONFIG_REQ_EVT, &evt); } AVDT_TRACE_DEBUG("%s: result=%d", __func__, result); return result; } Loading @@ -697,6 +766,9 @@ uint16_t AVDT_ReconfigRsp(uint8_t handle, uint8_t label, uint8_t error_code, tAVDT_SCB_EVT evt; uint16_t result = AVDT_SUCCESS; AVDT_TRACE_DEBUG("%s: handle=%d label=%d error_code=%d category=%d", __func__, handle, label, error_code, category); /* map handle to scb */ p_scb = avdt_scb_by_hdl(handle); if (p_scb == NULL) { Loading @@ -710,6 +782,8 @@ uint16_t AVDT_ReconfigRsp(uint8_t handle, uint8_t label, uint8_t error_code, avdt_scb_event(p_scb, AVDT_SCB_API_RECONFIG_RSP_EVT, &evt); } AVDT_TRACE_DEBUG("%s: result=%d", __func__, result); return result; } Loading @@ -732,6 +806,8 @@ uint16_t AVDT_SecurityReq(uint8_t handle, uint8_t* p_data, uint16_t len) { uint16_t result = AVDT_SUCCESS; tAVDT_SCB_EVT evt; AVDT_TRACE_DEBUG("%s: handle=%d len=%d", __func__, handle, len); /* map handle to scb */ p_scb = avdt_scb_by_hdl(handle); if (p_scb == NULL) { Loading @@ -743,6 +819,9 @@ uint16_t AVDT_SecurityReq(uint8_t handle, uint8_t* p_data, uint16_t len) { evt.msg.security_rsp.len = len; avdt_scb_event(p_scb, AVDT_SCB_API_SECURITY_REQ_EVT, &evt); } AVDT_TRACE_DEBUG("%s: result=%d", __func__, result); return result; } Loading @@ -766,6 +845,9 @@ uint16_t AVDT_SecurityRsp(uint8_t handle, uint8_t label, uint8_t error_code, uint16_t result = AVDT_SUCCESS; tAVDT_SCB_EVT evt; AVDT_TRACE_DEBUG("%s: handle=%d label=%d error_code=%d len=%d", __func__, handle, label, error_code, len); /* map handle to scb */ p_scb = avdt_scb_by_hdl(handle); if (p_scb == NULL) { Loading @@ -779,6 +861,9 @@ uint16_t AVDT_SecurityRsp(uint8_t handle, uint8_t label, uint8_t error_code, evt.msg.security_rsp.len = len; avdt_scb_event(p_scb, AVDT_SCB_API_SECURITY_RSP_EVT, &evt); } AVDT_TRACE_DEBUG("%s: result=%d", __func__, result); return result; } Loading Loading @@ -825,6 +910,9 @@ uint16_t AVDT_WriteReqOpt(uint8_t handle, BT_HDR* p_pkt, uint32_t time_stamp, tAVDT_SCB_EVT evt; uint16_t result = AVDT_SUCCESS; AVDT_TRACE_DEBUG("%s: handle=%d timestamp=%d m_pt=0x%x opt=0x%x", __func__, handle, time_stamp, m_pt, opt); /* map handle to scb */ p_scb = avdt_scb_by_hdl(handle); if (p_scb == NULL) { Loading @@ -837,6 +925,8 @@ uint16_t AVDT_WriteReqOpt(uint8_t handle, BT_HDR* p_pkt, uint32_t time_stamp, avdt_scb_event(p_scb, AVDT_SCB_API_WRITE_REQ_EVT, &evt); } AVDT_TRACE_DEBUG("%s: result=%d", __func__, result); return result; } Loading Loading @@ -900,6 +990,8 @@ uint16_t AVDT_ConnectReq(const RawAddress& bd_addr, uint8_t sec_mask, uint16_t result = AVDT_SUCCESS; tAVDT_CCB_EVT evt; AVDT_TRACE_DEBUG("%s: sec_mask=0x%x", __func__, sec_mask); /* find channel control block for this bd addr; if none, allocate one */ p_ccb = avdt_ccb_by_bd(bd_addr); if (p_ccb == NULL) { Loading @@ -921,6 +1013,9 @@ uint16_t AVDT_ConnectReq(const RawAddress& bd_addr, uint8_t sec_mask, evt.connect.sec_mask = sec_mask; avdt_ccb_event(p_ccb, AVDT_CCB_API_CONNECT_REQ_EVT, &evt); } AVDT_TRACE_DEBUG("%s: result=%d", __func__, result); return result; } Loading @@ -942,6 +1037,8 @@ uint16_t AVDT_DisconnectReq(const RawAddress& bd_addr, uint16_t result = AVDT_SUCCESS; tAVDT_CCB_EVT evt; AVDT_TRACE_DEBUG("%s", __func__); /* find channel control block for this bd addr; if none, error */ p_ccb = avdt_ccb_by_bd(bd_addr); if (p_ccb == NULL) { Loading @@ -953,6 +1050,9 @@ uint16_t AVDT_DisconnectReq(const RawAddress& bd_addr, evt.disconnect.p_cback = p_cback; avdt_ccb_event(p_ccb, AVDT_CCB_API_DISCONNECT_REQ_EVT, &evt); } AVDT_TRACE_DEBUG("%s: result=%d", __func__, result); return result; } Loading Loading @@ -1034,6 +1134,8 @@ uint16_t AVDT_SendReport(uint8_t handle, AVDT_REPORT_TYPE type, uint32_t ssrc; uint16_t len; AVDT_TRACE_DEBUG("%s: handle=%d type=%d", __func__, handle, type); /* map handle to scb && verify parameters */ if (((p_scb = avdt_scb_by_hdl(handle)) != NULL) && (p_scb->p_ccb != NULL) && (((type == AVDT_RTCP_PT_SR) && (p_scb->cs.tsep == AVDT_TSEP_SRC)) || Loading Loading @@ -1101,6 +1203,8 @@ uint16_t AVDT_SendReport(uint8_t handle, AVDT_REPORT_TYPE type, } } AVDT_TRACE_DEBUG("%s: result=%d", __func__, result); return result; } #endif Loading system/stack/avdt/avdt_ccb.cc +3 −3 Original line number Diff line number Diff line Loading @@ -37,7 +37,6 @@ /***************************************************************************** * state machine constants and types ****************************************************************************/ #if (AVDT_DEBUG == TRUE) /* verbose state strings for trace */ const char* const avdt_ccb_st_str[] = {"CCB_IDLE_ST", "CCB_OPENING_ST", Loading @@ -60,8 +59,6 @@ const char* const avdt_ccb_evt_str[] = { "UL_CLOSE_EVT", "LL_OPEN_EVT", "LL_CLOSE_EVT", "LL_CONG_EVT"}; #endif /* action function list */ const tAVDT_CCB_ACTION avdt_ccb_action[] = { avdt_ccb_chan_open, avdt_ccb_chan_close, Loading Loading @@ -387,6 +384,9 @@ void avdt_ccb_event(tAVDT_CCB* p_ccb, uint8_t event, tAVDT_CCB_EVT* p_data) { /* execute action functions */ for (i = 0; i < AVDT_CCB_ACTIONS; i++) { action = state_table[event][i]; AVDT_TRACE_DEBUG("%s: event=%s state=%s action=%d", __func__, avdt_ccb_evt_str[event], avdt_ccb_st_str[p_ccb->state], action); if (action != AVDT_CCB_IGNORE) { (*avdt_cb.p_ccb_act[action])(p_ccb, p_data); } else { Loading system/stack/avdt/avdt_ccb_act.cc +5 −0 Original line number Diff line number Diff line Loading @@ -486,6 +486,8 @@ void avdt_ccb_snd_start_cmd(tAVDT_CCB* p_ccb, tAVDT_CCB_EVT* p_data) { tAVDT_MSG avdt_msg; uint8_t seid_list[AVDT_NUM_SEPS]; AVDT_TRACE_DEBUG("%s", __func__); /* make copy of our seid list */ memcpy(seid_list, p_data->msg.multi.seid_list, p_data->msg.multi.num_seps); Loading @@ -494,6 +496,8 @@ void avdt_ccb_snd_start_cmd(tAVDT_CCB* p_ccb, tAVDT_CCB_EVT* p_data) { avdt_scb_verify(p_ccb, AVDT_VERIFY_OPEN, p_data->msg.multi.seid_list, p_data->msg.multi.num_seps, &avdt_msg.hdr.err_code); if (avdt_msg.hdr.err_param == 0) { AVDT_TRACE_DEBUG("%s: AVDT_SIG_START", __func__); /* set peer seid list in messsage */ avdt_scb_peer_seid_list(&p_data->msg.multi); Loading @@ -504,6 +508,7 @@ void avdt_ccb_snd_start_cmd(tAVDT_CCB* p_ccb, tAVDT_CCB_EVT* p_data) { for (i = 0; i < p_data->msg.multi.num_seps; i++) { p_scb = avdt_scb_by_hdl(seid_list[i]); if (p_scb != NULL) { AVDT_TRACE_DEBUG("%s: AVDT_SCB_MSG_START_REJ_EVT: i=%d", __func__, i); avdt_scb_event(p_scb, AVDT_SCB_MSG_START_REJ_EVT, (tAVDT_SCB_EVT*)&avdt_msg.hdr); } Loading Loading
system/bta/av/bta_av_aact.cc +39 −11 Original line number Diff line number Diff line Loading @@ -1095,6 +1095,10 @@ void bta_av_config_ind(tBTA_AV_SCB* p_scb, tBTA_AV_DATA* p_data) { local_sep = bta_av_get_scb_sep_type(p_scb, p_msg->handle); p_scb->avdt_label = p_data->str_msg.msg.hdr.label; APPL_TRACE_DEBUG("%s: local_sep = %d", __func__, local_sep); A2DP_DumpCodecInfo(p_evt_cfg->codec_info); memcpy(p_scb->cfg.codec_info, p_evt_cfg->codec_info, AVDT_CODEC_SIZE); bta_av_save_addr(p_scb, p_data->str_msg.bd_addr); Loading Loading @@ -1452,6 +1456,8 @@ void bta_av_security_cfm(tBTA_AV_SCB* p_scb, tBTA_AV_DATA* p_data) { * ******************************************************************************/ void bta_av_do_close(tBTA_AV_SCB* p_scb, UNUSED_ATTR tBTA_AV_DATA* p_data) { APPL_TRACE_DEBUG("%s: p_scb->co_started=%d", __func__, p_scb->co_started); /* stop stream if started */ if (p_scb->co_started) { bta_av_str_stopped(p_scb, NULL); Loading Loading @@ -1630,12 +1636,18 @@ void bta_av_save_caps(tBTA_AV_SCB* p_scb, tBTA_AV_DATA* p_data) { APPL_TRACE_DEBUG("%s: num_seps:%d sep_info_idx:%d wait:x%x", __func__, p_scb->num_seps, p_scb->sep_info_idx, p_scb->wait); A2DP_DumpCodecInfo(p_scb->p_cap->codec_info); memcpy(&cfg, p_scb->p_cap, sizeof(tAVDT_CFG)); /* let application know the capability of the SNK */ p_scb->p_cos->getcfg(p_scb->hndl, cfg.codec_info, &p_scb->sep_info_idx, p_info->seid, &cfg.num_protect, cfg.protect_info); p_scb->sep_info_idx++; APPL_TRACE_DEBUG("%s: result: sep_info_idx:%d", __func__, p_scb->sep_info_idx); A2DP_DumpCodecInfo(cfg.codec_info); if (p_scb->num_seps > p_scb->sep_info_idx) { /* Some devices have seps at the end of the discover list, which is not */ /* matching media type(video not audio). */ Loading @@ -1646,8 +1658,9 @@ void bta_av_save_caps(tBTA_AV_SCB* p_scb, tBTA_AV_DATA* p_data) { getcap_done = true; if (getcap_done) { /* we are done getting capabilities. restore the p_cb->sep_info_idx */ p_scb->sep_info_idx = 0; APPL_TRACE_DEBUG("%s: getcap_done: num_seps:%d sep_info_idx:%d wait:x%x", __func__, p_scb->num_seps, p_scb->sep_info_idx, p_scb->wait); p_scb->wait &= ~(BTA_AV_WAIT_ACP_CAPS_ON | BTA_AV_WAIT_ACP_CAPS_STARTED); if (old_wait & BTA_AV_WAIT_ACP_CAPS_STARTED) { bta_av_start_ok(p_scb, NULL); Loading Loading @@ -1765,6 +1778,7 @@ void bta_av_getcap_results(tBTA_AV_SCB* p_scb, tBTA_AV_DATA* p_data) { APPL_TRACE_DEBUG("%s: num_codec %d", __func__, p_scb->p_cap->num_codec); APPL_TRACE_DEBUG("%s: media type x%x, x%x", __func__, media_type, p_scb->media_type); A2DP_DumpCodecInfo(p_scb->cfg.codec_info); /* if codec present and we get a codec configuration */ if ((p_scb->p_cap->num_codec != 0) && (media_type == p_scb->media_type) && Loading @@ -1774,6 +1788,10 @@ void bta_av_getcap_results(tBTA_AV_SCB* p_scb, tBTA_AV_DATA* p_data) { /* save copy of codec configuration */ memcpy(&p_scb->cfg, &cfg, sizeof(tAVDT_CFG)); APPL_TRACE_DEBUG("%s: result: sep_info_idx=%d", __func__, p_scb->sep_info_idx); A2DP_DumpCodecInfo(p_scb->cfg.codec_info); uuid_int = p_scb->uuid_int; APPL_TRACE_DEBUG("%s: initiator UUID = 0x%x", __func__, uuid_int); if (uuid_int == UUID_SERVCLASS_AUDIO_SOURCE) Loading Loading @@ -2031,16 +2049,22 @@ void bta_av_reconfig(tBTA_AV_SCB* p_scb, tBTA_AV_DATA* p_data) { /* store the new configuration in control block */ if (p_scb->p_cap == NULL) p_scb->p_cap = (tAVDT_CFG*)osi_malloc(sizeof(tAVDT_CFG)); p_cfg = p_scb->p_cap; p_cfg = &p_scb->cfg; alarm_cancel(p_scb->avrc_ct_timer); memcpy(p_cfg, &p_scb->cfg, sizeof(tAVDT_CFG)); APPL_TRACE_DEBUG( "%s: p_scb->sep_info_idx=%d p_scb->rcfg_idx=%d p_rcfg->sep_info_idx=%d", __func__, p_scb->sep_info_idx, p_scb->rcfg_idx, p_rcfg->sep_info_idx); A2DP_DumpCodecInfo(p_scb->p_cap->codec_info); A2DP_DumpCodecInfo(p_scb->cfg.codec_info); A2DP_DumpCodecInfo(p_rcfg->codec_info); p_cfg->num_protect = p_rcfg->num_protect; memcpy(p_cfg->codec_info, p_rcfg->codec_info, AVDT_CODEC_SIZE); memcpy(p_cfg->protect_info, p_rcfg->p_protect_info, p_rcfg->num_protect); p_scb->rcfg_idx = p_rcfg->sep_info_idx; p_scb->p_cap->psc_mask = p_scb->cur_psc_mask; p_cfg->psc_mask = p_scb->cur_psc_mask; // If the requested SEP index is same as the current one, then we // can Suspend->Reconfigure->Start. Loading @@ -2057,8 +2081,9 @@ void bta_av_reconfig(tBTA_AV_SCB* p_scb, tBTA_AV_DATA* p_data) { } else { // Reconfigure APPL_TRACE_DEBUG("%s: reconfig", __func__); AVDT_ReconfigReq(p_scb->avdt_handle, p_scb->p_cap); p_scb->p_cap->psc_mask = p_scb->cur_psc_mask; A2DP_DumpCodecInfo(p_scb->cfg.codec_info); AVDT_ReconfigReq(p_scb->avdt_handle, &p_scb->cfg); p_scb->cfg.psc_mask = p_scb->cur_psc_mask; } } else { // Close the stream first, and then Configure it Loading Loading @@ -2726,8 +2751,9 @@ void bta_av_suspend_cont(tBTA_AV_SCB* p_scb, tBTA_AV_DATA* p_data) { APPL_TRACE_DEBUG("%s: calling AVDT_ReconfigReq", __func__); /* reconfig the stream */ AVDT_ReconfigReq(p_scb->avdt_handle, p_scb->p_cap); p_scb->p_cap->psc_mask = p_scb->cur_psc_mask; A2DP_DumpCodecInfo(p_scb->cfg.codec_info); AVDT_ReconfigReq(p_scb->avdt_handle, &p_scb->cfg); p_scb->cfg.psc_mask = p_scb->cur_psc_mask; } } Loading Loading @@ -2807,7 +2833,9 @@ void bta_av_rcfg_open(tBTA_AV_SCB* p_scb, UNUSED_ATTR tBTA_AV_DATA* p_data) { AVDT_DiscoverReq(p_scb->peer_addr, p_scb->sep_info, BTA_AV_NUM_SEPS, bta_av_dt_cback[p_scb->hdi]); } else { memcpy(p_scb->cfg.codec_info, p_scb->p_cap->codec_info, AVDT_CODEC_SIZE); APPL_TRACE_DEBUG("%s: calling AVDT_OpenReq()", __func__); A2DP_DumpCodecInfo(p_scb->cfg.codec_info); /* we may choose to use a different SEP at reconfig. * adjust the sep_idx now */ bta_av_adjust_seps_idx(p_scb, bta_av_get_scb_handle(p_scb, AVDT_TSEP_SRC)); Loading @@ -2815,7 +2843,7 @@ void bta_av_rcfg_open(tBTA_AV_SCB* p_scb, UNUSED_ATTR tBTA_AV_DATA* p_data) { /* open the stream with the new config */ p_scb->sep_info_idx = p_scb->rcfg_idx; AVDT_OpenReq(p_scb->avdt_handle, p_scb->peer_addr, p_scb->sep_info[p_scb->sep_info_idx].seid, p_scb->p_cap); p_scb->sep_info[p_scb->sep_info_idx].seid, &p_scb->cfg); } } Loading
system/btif/co/bta_av_co.cc +31 −3 Original line number Diff line number Diff line Loading @@ -395,6 +395,7 @@ tA2DP_STATUS bta_av_co_audio_getconfig(tBTA_AV_HNDL hndl, uint8_t* p_codec_info, tBTA_AV_CO_PEER* p_peer; APPL_TRACE_DEBUG("%s", __func__); A2DP_DumpCodecInfo(p_codec_info); /* Retrieve the peer info */ p_peer = bta_av_co_get_peer(hndl); Loading Loading @@ -507,6 +508,7 @@ void bta_av_co_audio_setconfig(tBTA_AV_HNDL hndl, const uint8_t* p_codec_info, APPL_TRACE_DEBUG("num_protect:0x%02x protect_info:0x%02x%02x%02x", num_protect, p_protect_info[0], p_protect_info[1], p_protect_info[2]); A2DP_DumpCodecInfo(p_codec_info); /* Retrieve the peer info */ p_peer = bta_av_co_get_peer(hndl); Loading Loading @@ -992,6 +994,9 @@ static void bta_av_co_save_new_codec_config(tBTA_AV_CO_PEER* p_peer, const uint8_t* new_codec_config, uint8_t num_protect, const uint8_t* p_protect_info) { APPL_TRACE_DEBUG("%s", __func__); A2DP_DumpCodecInfo(new_codec_config); // Protect access to bta_av_co_cb.codec_config mutex_global_lock(); Loading Loading @@ -1114,6 +1119,15 @@ bool bta_av_co_set_codec_user_config( success = false; goto done; } // Don't call BTA_AvReconfig() prior to retrieving all peer's capabilities if ((p_peer->num_rx_sinks != p_peer->num_sinks) && (p_peer->num_sup_sinks != BTA_AV_CO_NUM_ELEMENTS(p_peer->sinks))) { APPL_TRACE_WARNING("%s: not all peer's capabilities have been retrieved", __func__); success = false; goto done; } APPL_TRACE_DEBUG("%s: call BTA_AvReconfig(x%x)", __func__, p_peer->handle); BTA_AvReconfig(p_peer->handle, true, p_sink->sep_info_idx, p_peer->codec_config, num_protect, bta_av_co_cp_scmst); Loading Loading @@ -1154,6 +1168,9 @@ static bool bta_av_co_set_codec_ota_config(tBTA_AV_CO_PEER* p_peer, bool restart_output = false; bool config_updated = false; APPL_TRACE_DEBUG("%s", __func__); A2DP_DumpCodecInfo(p_ota_codec_config); *p_restart_output = false; // Find the peer SEP codec to use Loading Loading @@ -1190,6 +1207,9 @@ static bool bta_av_co_set_codec_ota_config(tBTA_AV_CO_PEER* p_peer, } if (restart_output) { APPL_TRACE_DEBUG("%s: restart output", __func__); A2DP_DumpCodecInfo(result_codec_config); *p_restart_output = true; p_peer->p_sink = p_sink; bta_av_co_save_new_codec_config(p_peer, result_codec_config, num_protect, Loading Loading @@ -1249,10 +1269,18 @@ bool bta_av_co_set_codec_audio_config( bta_av_co_save_new_codec_config(p_peer, result_codec_config, p_sink->num_protect, p_sink->protect_info); APPL_TRACE_DEBUG("%s: call BTA_AvReconfig(x%x)", __func__, p_peer->handle); // Don't call BTA_AvReconfig() prior to retrieving all peer's capabilities if ((p_peer->num_rx_sinks != p_peer->num_sinks) && (p_peer->num_sup_sinks != BTA_AV_CO_NUM_ELEMENTS(p_peer->sinks))) { APPL_TRACE_WARNING("%s: not all peer's capabilities have been retrieved", __func__); } else { APPL_TRACE_DEBUG("%s: call BTA_AvReconfig(x%x)", __func__, p_peer->handle); BTA_AvReconfig(p_peer->handle, true, p_sink->sep_info_idx, p_peer->codec_config, num_protect, bta_av_co_cp_scmst); } } if (config_updated) { // NOTE: Currently, the input is restarted by sending an upcall Loading
system/stack/avdt/avdt_api.cc +108 −4 Original line number Diff line number Diff line Loading @@ -32,6 +32,7 @@ #include "btm_api.h" #include "btu.h" #include "l2c_api.h" #include "stack/include/a2dp_codec_api.h" /* Control block for AVDT */ tAVDT_CB avdt_cb; Loading Loading @@ -135,7 +136,7 @@ void AVDT_Deregister(void) { } void AVDT_AbortReq(uint8_t handle) { AVDT_TRACE_ERROR("%s", __func__); AVDT_TRACE_WARNING("%s: handle=%d", __func__, handle); tAVDT_SCB* p_scb = avdt_scb_by_hdl(handle); if (p_scb != NULL) { Loading Loading @@ -163,6 +164,8 @@ uint16_t AVDT_CreateStream(uint8_t* p_handle, tAVDT_CS* p_cs) { uint16_t result = AVDT_SUCCESS; tAVDT_SCB* p_scb; AVDT_TRACE_DEBUG("%s", __func__); /* Verify parameters; if invalid, return failure */ if (((p_cs->cfg.psc_mask & (~AVDT_PSC)) != 0) || (p_cs->p_ctrl_cback == NULL)) { Loading @@ -177,6 +180,9 @@ uint16_t AVDT_CreateStream(uint8_t* p_handle, tAVDT_CS* p_cs) { *p_handle = avdt_scb_to_hdl(p_scb); } } AVDT_TRACE_DEBUG("%s: result=%d", __func__, result); return result; } Loading @@ -198,6 +204,8 @@ uint16_t AVDT_RemoveStream(uint8_t handle) { uint16_t result = AVDT_SUCCESS; tAVDT_SCB* p_scb; AVDT_TRACE_DEBUG("%s: handle=%d", __func__, handle); /* look up scb */ p_scb = avdt_scb_by_hdl(handle); if (p_scb == NULL) { Loading @@ -206,6 +214,9 @@ uint16_t AVDT_RemoveStream(uint8_t handle) { /* send remove event to scb */ avdt_scb_event(p_scb, AVDT_SCB_API_REMOVE_EVT, NULL); } AVDT_TRACE_DEBUG("%s: result=%d", __func__, result); return result; } Loading Loading @@ -241,6 +252,8 @@ uint16_t AVDT_DiscoverReq(const RawAddress& bd_addr, tAVDT_SEP_INFO* p_sep_info, uint16_t result = AVDT_SUCCESS; tAVDT_CCB_EVT evt; AVDT_TRACE_DEBUG("%s", __func__); /* find channel control block for this bd addr; if none, allocate one */ p_ccb = avdt_ccb_by_bd(bd_addr); if (p_ccb == NULL) { Loading @@ -264,6 +277,9 @@ uint16_t AVDT_DiscoverReq(const RawAddress& bd_addr, tAVDT_SEP_INFO* p_sep_info, avdt_ccb_event(p_ccb, AVDT_CCB_API_DISCOVER_REQ_EVT, &evt); } } AVDT_TRACE_DEBUG("%s: result=%d", __func__, result); return result; } Loading @@ -282,6 +298,8 @@ static uint16_t avdt_get_cap_req(const RawAddress& bd_addr, tAVDT_CCB* p_ccb = NULL; uint16_t result = AVDT_SUCCESS; AVDT_TRACE_DEBUG("%s", __func__); /* verify SEID */ if ((p_evt->single.seid < AVDT_SEID_MIN) || (p_evt->single.seid > AVDT_SEID_MAX)) { Loading Loading @@ -310,6 +328,9 @@ static uint16_t avdt_get_cap_req(const RawAddress& bd_addr, avdt_ccb_event(p_ccb, AVDT_CCB_API_GETCAP_REQ_EVT, (tAVDT_CCB_EVT*)p_evt); } } AVDT_TRACE_DEBUG("%s: result=%d", __func__, result); return result; } Loading Loading @@ -340,12 +361,19 @@ static uint16_t avdt_get_cap_req(const RawAddress& bd_addr, uint16_t AVDT_GetCapReq(const RawAddress& bd_addr, uint8_t seid, tAVDT_CFG* p_cfg, tAVDT_CTRL_CBACK* p_cback) { tAVDT_CCB_API_GETCAP getcap; uint16_t result = AVDT_SUCCESS; AVDT_TRACE_DEBUG("%s", __func__); getcap.single.seid = seid; getcap.single.sig_id = AVDT_SIG_GETCAP; getcap.p_cfg = p_cfg; getcap.p_cback = p_cback; return avdt_get_cap_req(bd_addr, &getcap); result = avdt_get_cap_req(bd_addr, &getcap); AVDT_TRACE_DEBUG("%s: result=%d", __func__, result); return result; } /******************************************************************************* Loading Loading @@ -375,12 +403,19 @@ uint16_t AVDT_GetCapReq(const RawAddress& bd_addr, uint8_t seid, uint16_t AVDT_GetAllCapReq(const RawAddress& bd_addr, uint8_t seid, tAVDT_CFG* p_cfg, tAVDT_CTRL_CBACK* p_cback) { tAVDT_CCB_API_GETCAP getcap; uint16_t result = AVDT_SUCCESS; AVDT_TRACE_DEBUG("%s", __func__); getcap.single.seid = seid; getcap.single.sig_id = AVDT_SIG_GET_ALLCAP; getcap.p_cfg = p_cfg; getcap.p_cback = p_cback; return avdt_get_cap_req(bd_addr, &getcap); result = avdt_get_cap_req(bd_addr, &getcap); AVDT_TRACE_DEBUG("%s: result=%d", __func__, result); return result; } /******************************************************************************* Loading @@ -399,6 +434,9 @@ uint16_t AVDT_DelayReport(uint8_t handle, uint8_t seid, uint16_t delay) { uint16_t result = AVDT_SUCCESS; tAVDT_SCB_EVT evt; AVDT_TRACE_DEBUG("%s: handle=%d ceid=%d delay=%d", __func__, handle, seid, delay); /* map handle to scb */ p_scb = avdt_scb_by_hdl(handle); if (p_scb == NULL) { Loading @@ -411,6 +449,8 @@ uint16_t AVDT_DelayReport(uint8_t handle, uint8_t seid, uint16_t delay) { avdt_scb_event(p_scb, AVDT_SCB_API_DELAY_RPT_REQ_EVT, &evt); } AVDT_TRACE_DEBUG("%s: result=%d", __func__, result); return result; } Loading @@ -435,6 +475,8 @@ uint16_t AVDT_OpenReq(uint8_t handle, const RawAddress& bd_addr, uint8_t seid, uint16_t result = AVDT_SUCCESS; tAVDT_SCB_EVT evt; AVDT_TRACE_DEBUG("%s: handle=%d seid=%d", __func__, handle, seid); /* verify SEID */ if ((seid < AVDT_SEID_MIN) || (seid > AVDT_SEID_MAX)) { result = AVDT_BAD_PARAMS; Loading @@ -460,12 +502,17 @@ uint16_t AVDT_OpenReq(uint8_t handle, const RawAddress& bd_addr, uint8_t seid, /* send event to scb */ if (result == AVDT_SUCCESS) { A2DP_DumpCodecInfo(p_cfg->codec_info); evt.msg.config_cmd.hdr.seid = seid; evt.msg.config_cmd.hdr.ccb_idx = avdt_ccb_to_idx(p_ccb); evt.msg.config_cmd.int_seid = handle; evt.msg.config_cmd.p_cfg = p_cfg; avdt_scb_event(p_scb, AVDT_SCB_API_SETCONFIG_REQ_EVT, &evt); } AVDT_TRACE_DEBUG("%s: result=%d", __func__, result); return result; } Loading @@ -488,6 +535,9 @@ uint16_t AVDT_ConfigRsp(uint8_t handle, uint8_t label, uint8_t error_code, uint16_t result = AVDT_SUCCESS; uint8_t event_code; AVDT_TRACE_DEBUG("%s: handle=%d label=%d error_code=%d category=%d", __func__, handle, label, error_code, category); /* map handle to scb */ p_scb = avdt_scb_by_hdl(handle); if (p_scb == NULL) { Loading @@ -512,6 +562,8 @@ uint16_t AVDT_ConfigRsp(uint8_t handle, uint8_t label, uint8_t error_code, avdt_scb_event(p_scb, event_code, &evt); } AVDT_TRACE_DEBUG("%s: result=%d", __func__, result); return result; } Loading @@ -536,6 +588,8 @@ uint16_t AVDT_StartReq(uint8_t* p_handles, uint8_t num_handles) { uint16_t result = AVDT_SUCCESS; int i; AVDT_TRACE_DEBUG("%s: num_handles=%d", __func__, num_handles); if ((num_handles == 0) || (num_handles > AVDT_NUM_SEPS)) { result = AVDT_BAD_PARAMS; } else { Loading @@ -559,6 +613,9 @@ uint16_t AVDT_StartReq(uint8_t* p_handles, uint8_t num_handles) { avdt_ccb_event(p_scb->p_ccb, AVDT_CCB_API_START_REQ_EVT, &evt); } } AVDT_TRACE_DEBUG("%s: result=%d", __func__, result); return result; } Loading @@ -583,6 +640,8 @@ uint16_t AVDT_SuspendReq(uint8_t* p_handles, uint8_t num_handles) { uint16_t result = AVDT_SUCCESS; int i; AVDT_TRACE_DEBUG("%s: num_handles=%d", __func__, num_handles); if ((num_handles == 0) || (num_handles > AVDT_NUM_SEPS)) { result = AVDT_BAD_PARAMS; } else { Loading @@ -607,6 +666,8 @@ uint16_t AVDT_SuspendReq(uint8_t* p_handles, uint8_t num_handles) { } } AVDT_TRACE_DEBUG("%s: result=%d", __func__, result); return result; } Loading @@ -628,6 +689,8 @@ uint16_t AVDT_CloseReq(uint8_t handle) { tAVDT_SCB* p_scb; uint16_t result = AVDT_SUCCESS; AVDT_TRACE_DEBUG("%s: handle=%d", __func__, handle); /* map handle to scb */ p_scb = avdt_scb_by_hdl(handle); if (p_scb == NULL) { Loading @@ -638,6 +701,8 @@ uint16_t AVDT_CloseReq(uint8_t handle) { avdt_scb_event(p_scb, AVDT_SCB_API_CLOSE_REQ_EVT, NULL); } AVDT_TRACE_DEBUG("%s: result=%d", __func__, result); return result; } Loading @@ -663,6 +728,8 @@ uint16_t AVDT_ReconfigReq(uint8_t handle, tAVDT_CFG* p_cfg) { uint16_t result = AVDT_SUCCESS; tAVDT_SCB_EVT evt; AVDT_TRACE_DEBUG("%s: handle=%d", __func__, handle); /* map handle to scb */ p_scb = avdt_scb_by_hdl(handle); if (p_scb == NULL) { Loading @@ -672,10 +739,12 @@ uint16_t AVDT_ReconfigReq(uint8_t handle, tAVDT_CFG* p_cfg) { else { /* force psc_mask to zero */ p_cfg->psc_mask = 0; evt.msg.reconfig_cmd.p_cfg = p_cfg; avdt_scb_event(p_scb, AVDT_SCB_API_RECONFIG_REQ_EVT, &evt); } AVDT_TRACE_DEBUG("%s: result=%d", __func__, result); return result; } Loading @@ -697,6 +766,9 @@ uint16_t AVDT_ReconfigRsp(uint8_t handle, uint8_t label, uint8_t error_code, tAVDT_SCB_EVT evt; uint16_t result = AVDT_SUCCESS; AVDT_TRACE_DEBUG("%s: handle=%d label=%d error_code=%d category=%d", __func__, handle, label, error_code, category); /* map handle to scb */ p_scb = avdt_scb_by_hdl(handle); if (p_scb == NULL) { Loading @@ -710,6 +782,8 @@ uint16_t AVDT_ReconfigRsp(uint8_t handle, uint8_t label, uint8_t error_code, avdt_scb_event(p_scb, AVDT_SCB_API_RECONFIG_RSP_EVT, &evt); } AVDT_TRACE_DEBUG("%s: result=%d", __func__, result); return result; } Loading @@ -732,6 +806,8 @@ uint16_t AVDT_SecurityReq(uint8_t handle, uint8_t* p_data, uint16_t len) { uint16_t result = AVDT_SUCCESS; tAVDT_SCB_EVT evt; AVDT_TRACE_DEBUG("%s: handle=%d len=%d", __func__, handle, len); /* map handle to scb */ p_scb = avdt_scb_by_hdl(handle); if (p_scb == NULL) { Loading @@ -743,6 +819,9 @@ uint16_t AVDT_SecurityReq(uint8_t handle, uint8_t* p_data, uint16_t len) { evt.msg.security_rsp.len = len; avdt_scb_event(p_scb, AVDT_SCB_API_SECURITY_REQ_EVT, &evt); } AVDT_TRACE_DEBUG("%s: result=%d", __func__, result); return result; } Loading @@ -766,6 +845,9 @@ uint16_t AVDT_SecurityRsp(uint8_t handle, uint8_t label, uint8_t error_code, uint16_t result = AVDT_SUCCESS; tAVDT_SCB_EVT evt; AVDT_TRACE_DEBUG("%s: handle=%d label=%d error_code=%d len=%d", __func__, handle, label, error_code, len); /* map handle to scb */ p_scb = avdt_scb_by_hdl(handle); if (p_scb == NULL) { Loading @@ -779,6 +861,9 @@ uint16_t AVDT_SecurityRsp(uint8_t handle, uint8_t label, uint8_t error_code, evt.msg.security_rsp.len = len; avdt_scb_event(p_scb, AVDT_SCB_API_SECURITY_RSP_EVT, &evt); } AVDT_TRACE_DEBUG("%s: result=%d", __func__, result); return result; } Loading Loading @@ -825,6 +910,9 @@ uint16_t AVDT_WriteReqOpt(uint8_t handle, BT_HDR* p_pkt, uint32_t time_stamp, tAVDT_SCB_EVT evt; uint16_t result = AVDT_SUCCESS; AVDT_TRACE_DEBUG("%s: handle=%d timestamp=%d m_pt=0x%x opt=0x%x", __func__, handle, time_stamp, m_pt, opt); /* map handle to scb */ p_scb = avdt_scb_by_hdl(handle); if (p_scb == NULL) { Loading @@ -837,6 +925,8 @@ uint16_t AVDT_WriteReqOpt(uint8_t handle, BT_HDR* p_pkt, uint32_t time_stamp, avdt_scb_event(p_scb, AVDT_SCB_API_WRITE_REQ_EVT, &evt); } AVDT_TRACE_DEBUG("%s: result=%d", __func__, result); return result; } Loading Loading @@ -900,6 +990,8 @@ uint16_t AVDT_ConnectReq(const RawAddress& bd_addr, uint8_t sec_mask, uint16_t result = AVDT_SUCCESS; tAVDT_CCB_EVT evt; AVDT_TRACE_DEBUG("%s: sec_mask=0x%x", __func__, sec_mask); /* find channel control block for this bd addr; if none, allocate one */ p_ccb = avdt_ccb_by_bd(bd_addr); if (p_ccb == NULL) { Loading @@ -921,6 +1013,9 @@ uint16_t AVDT_ConnectReq(const RawAddress& bd_addr, uint8_t sec_mask, evt.connect.sec_mask = sec_mask; avdt_ccb_event(p_ccb, AVDT_CCB_API_CONNECT_REQ_EVT, &evt); } AVDT_TRACE_DEBUG("%s: result=%d", __func__, result); return result; } Loading @@ -942,6 +1037,8 @@ uint16_t AVDT_DisconnectReq(const RawAddress& bd_addr, uint16_t result = AVDT_SUCCESS; tAVDT_CCB_EVT evt; AVDT_TRACE_DEBUG("%s", __func__); /* find channel control block for this bd addr; if none, error */ p_ccb = avdt_ccb_by_bd(bd_addr); if (p_ccb == NULL) { Loading @@ -953,6 +1050,9 @@ uint16_t AVDT_DisconnectReq(const RawAddress& bd_addr, evt.disconnect.p_cback = p_cback; avdt_ccb_event(p_ccb, AVDT_CCB_API_DISCONNECT_REQ_EVT, &evt); } AVDT_TRACE_DEBUG("%s: result=%d", __func__, result); return result; } Loading Loading @@ -1034,6 +1134,8 @@ uint16_t AVDT_SendReport(uint8_t handle, AVDT_REPORT_TYPE type, uint32_t ssrc; uint16_t len; AVDT_TRACE_DEBUG("%s: handle=%d type=%d", __func__, handle, type); /* map handle to scb && verify parameters */ if (((p_scb = avdt_scb_by_hdl(handle)) != NULL) && (p_scb->p_ccb != NULL) && (((type == AVDT_RTCP_PT_SR) && (p_scb->cs.tsep == AVDT_TSEP_SRC)) || Loading Loading @@ -1101,6 +1203,8 @@ uint16_t AVDT_SendReport(uint8_t handle, AVDT_REPORT_TYPE type, } } AVDT_TRACE_DEBUG("%s: result=%d", __func__, result); return result; } #endif Loading
system/stack/avdt/avdt_ccb.cc +3 −3 Original line number Diff line number Diff line Loading @@ -37,7 +37,6 @@ /***************************************************************************** * state machine constants and types ****************************************************************************/ #if (AVDT_DEBUG == TRUE) /* verbose state strings for trace */ const char* const avdt_ccb_st_str[] = {"CCB_IDLE_ST", "CCB_OPENING_ST", Loading @@ -60,8 +59,6 @@ const char* const avdt_ccb_evt_str[] = { "UL_CLOSE_EVT", "LL_OPEN_EVT", "LL_CLOSE_EVT", "LL_CONG_EVT"}; #endif /* action function list */ const tAVDT_CCB_ACTION avdt_ccb_action[] = { avdt_ccb_chan_open, avdt_ccb_chan_close, Loading Loading @@ -387,6 +384,9 @@ void avdt_ccb_event(tAVDT_CCB* p_ccb, uint8_t event, tAVDT_CCB_EVT* p_data) { /* execute action functions */ for (i = 0; i < AVDT_CCB_ACTIONS; i++) { action = state_table[event][i]; AVDT_TRACE_DEBUG("%s: event=%s state=%s action=%d", __func__, avdt_ccb_evt_str[event], avdt_ccb_st_str[p_ccb->state], action); if (action != AVDT_CCB_IGNORE) { (*avdt_cb.p_ccb_act[action])(p_ccb, p_data); } else { Loading
system/stack/avdt/avdt_ccb_act.cc +5 −0 Original line number Diff line number Diff line Loading @@ -486,6 +486,8 @@ void avdt_ccb_snd_start_cmd(tAVDT_CCB* p_ccb, tAVDT_CCB_EVT* p_data) { tAVDT_MSG avdt_msg; uint8_t seid_list[AVDT_NUM_SEPS]; AVDT_TRACE_DEBUG("%s", __func__); /* make copy of our seid list */ memcpy(seid_list, p_data->msg.multi.seid_list, p_data->msg.multi.num_seps); Loading @@ -494,6 +496,8 @@ void avdt_ccb_snd_start_cmd(tAVDT_CCB* p_ccb, tAVDT_CCB_EVT* p_data) { avdt_scb_verify(p_ccb, AVDT_VERIFY_OPEN, p_data->msg.multi.seid_list, p_data->msg.multi.num_seps, &avdt_msg.hdr.err_code); if (avdt_msg.hdr.err_param == 0) { AVDT_TRACE_DEBUG("%s: AVDT_SIG_START", __func__); /* set peer seid list in messsage */ avdt_scb_peer_seid_list(&p_data->msg.multi); Loading @@ -504,6 +508,7 @@ void avdt_ccb_snd_start_cmd(tAVDT_CCB* p_ccb, tAVDT_CCB_EVT* p_data) { for (i = 0; i < p_data->msg.multi.num_seps; i++) { p_scb = avdt_scb_by_hdl(seid_list[i]); if (p_scb != NULL) { AVDT_TRACE_DEBUG("%s: AVDT_SCB_MSG_START_REJ_EVT: i=%d", __func__, i); avdt_scb_event(p_scb, AVDT_SCB_MSG_START_REJ_EVT, (tAVDT_SCB_EVT*)&avdt_msg.hdr); } Loading