Loading system/bta/av/bta_av_aact.cc +55 −55 Original line number Diff line number Diff line Loading @@ -82,7 +82,7 @@ enum /* the call out functions for audio stream */ const tBTA_AV_CO_FUNCTS bta_av_a2d_cos = const tBTA_AV_CO_FUNCTS bta_av_a2dp_cos = { bta_av_co_audio_init, bta_av_co_audio_disc_res, Loading @@ -97,9 +97,9 @@ const tBTA_AV_CO_FUNCTS bta_av_a2d_cos = }; /* ssm action functions for audio stream */ const tBTA_AV_SACT bta_av_a2d_action[] = const tBTA_AV_SACT bta_av_a2dp_action[] = { bta_av_do_disc_a2d, /* BTA_AV_DO_DISC */ bta_av_do_disc_a2dp, /* BTA_AV_DO_DISC */ bta_av_cleanup, /* BTA_AV_CLEANUP */ bta_av_free_sdb, /* BTA_AV_FREE_SDB */ bta_av_config_ind, /* BTA_AV_CONFIG_IND */ Loading Loading @@ -250,9 +250,9 @@ tAVDT_CTRL_CBACK * const bta_av_dt_cback[] = ***********************************************/ static uint8_t bta_av_get_scb_handle(tBTA_AV_SCB *p_scb, uint8_t local_sep) { for (int i = 0; i < A2D_CODEC_SEP_INDEX_MAX; i++) { for (int i = 0; i < A2DP_CODEC_SEP_INDEX_MAX; i++) { if ((p_scb->seps[i].tsep == local_sep) && A2D_CodecTypeEquals(p_scb->seps[i].codec_info, A2DP_CodecTypeEquals(p_scb->seps[i].codec_info, p_scb->cfg.codec_info)) { return (p_scb->seps[i].av_handle); } Loading @@ -272,7 +272,7 @@ static uint8_t bta_av_get_scb_handle(tBTA_AV_SCB *p_scb, uint8_t local_sep) ***********************************************/ static uint8_t bta_av_get_scb_sep_type(tBTA_AV_SCB *p_scb, uint8_t tavdt_handle) { for (int i = 0; i < A2D_CODEC_SEP_INDEX_MAX; i++) { for (int i = 0; i < A2DP_CODEC_SEP_INDEX_MAX; i++) { if (p_scb->seps[i].av_handle == tavdt_handle) return (p_scb->seps[i].tsep); } Loading Loading @@ -704,14 +704,14 @@ static void bta_av_stream5_cback(uint8_t handle, BD_ADDR bd_addr, uint8_t event, /******************************************************************************* ** ** Function bta_av_a2d_sdp_cback ** Function bta_av_a2dp_sdp_cback ** ** Description A2DP service discovery callback. ** ** Returns void ** *******************************************************************************/ static void bta_av_a2d_sdp_cback(bool found, tA2D_Service *p_service) static void bta_av_a2dp_sdp_cback(bool found, tA2DP_Service *p_service) { tBTA_AV_SCB *p_scb = bta_av_hndl_to_scb(bta_av_cb.handle); Loading Loading @@ -746,14 +746,14 @@ static void bta_av_a2d_sdp_cback(bool found, tA2D_Service *p_service) static void bta_av_adjust_seps_idx(tBTA_AV_SCB *p_scb, uint8_t avdt_handle) { APPL_TRACE_DEBUG("%s: codec: %s", __func__, A2D_CodecName(p_scb->cfg.codec_info)); for (int i = 0; i < A2D_CODEC_SEP_INDEX_MAX; i++) { A2DP_CodecName(p_scb->cfg.codec_info)); for (int i = 0; i < A2DP_CODEC_SEP_INDEX_MAX; i++) { APPL_TRACE_DEBUG("%s: av_handle: %d codec: %d", __func__, p_scb->seps[i].av_handle, A2D_CodecName(p_scb->seps[i].codec_info)); A2DP_CodecName(p_scb->seps[i].codec_info)); if (p_scb->seps[i].av_handle && (p_scb->seps[i].av_handle == avdt_handle) && A2D_CodecTypeEquals(p_scb->seps[i].codec_info, A2DP_CodecTypeEquals(p_scb->seps[i].codec_info, p_scb->cfg.codec_info)) { p_scb->sep_idx = i; p_scb->avdt_handle = p_scb->seps[i].av_handle; Loading Loading @@ -787,14 +787,14 @@ void bta_av_switch_role (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data) if (p_scb->q_tag == BTA_AV_Q_TAG_OPEN) { if (bta_av_switch_if_needed(p_scb) || !bta_av_link_role_ok(p_scb, A2D_SET_MULTL_BIT)) { if (bta_av_switch_if_needed(p_scb) || !bta_av_link_role_ok(p_scb, A2DP_SET_MULTL_BIT)) { p_scb->wait |= BTA_AV_WAIT_ROLE_SW_RES_OPEN; } else { /* this should not happen in theory. Just in case... * continue to do_disc_a2d */ * continue to do_disc_a2dp */ switch_res = BTA_AV_RS_DONE; } } Loading @@ -813,7 +813,7 @@ void bta_av_switch_role (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data) p_scb->wait &= ~BTA_AV_WAIT_ROLE_SW_RETRY; p_scb->q_tag = 0; p_buf->switch_res = switch_res; bta_av_do_disc_a2d(p_scb, (tBTA_AV_DATA *)p_buf); bta_av_do_disc_a2dp(p_scb, (tBTA_AV_DATA *)p_buf); } } Loading Loading @@ -886,7 +886,7 @@ void bta_av_role_res (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data) { /* Continue av open process */ p_scb->q_info.open.switch_res = BTA_AV_RS_DONE; bta_av_do_disc_a2d (p_scb, (tBTA_AV_DATA *)&(p_scb->q_info.open)); bta_av_do_disc_a2dp(p_scb, (tBTA_AV_DATA *)&(p_scb->q_info.open)); } } else Loading Loading @@ -917,17 +917,17 @@ void bta_av_delay_co (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data) /******************************************************************************* ** ** Function bta_av_do_disc_a2d ** Function bta_av_do_disc_a2dp ** ** Description Do service discovery for A2DP. ** ** Returns void ** *******************************************************************************/ void bta_av_do_disc_a2d (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data) void bta_av_do_disc_a2dp(tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data) { bool ok_continue = false; tA2D_SDP_DB_PARAMS db_params; tA2DP_SDP_DB_PARAMS db_params; uint16_t attr_list[] = {ATTR_ID_SERVICE_CLASS_ID_LIST, ATTR_ID_PROTOCOL_DESC_LIST, ATTR_ID_BT_PROFILE_DESC_LIST}; Loading @@ -941,8 +941,8 @@ void bta_av_do_disc_a2d (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data) switch(p_data->api_open.switch_res) { case BTA_AV_RS_NONE: if (bta_av_switch_if_needed(p_scb) || !bta_av_link_role_ok(p_scb, A2D_SET_MULTL_BIT)) { if (bta_av_switch_if_needed(p_scb) || !bta_av_link_role_ok(p_scb, A2DP_SET_MULTL_BIT)) { /* waiting for role switch result. save the api to control block */ memcpy(&p_scb->q_info.open, &p_data->api_open, sizeof(tBTA_AV_API_OPEN)); p_scb->wait |= BTA_AV_WAIT_ROLE_SW_RES_OPEN; Loading @@ -963,7 +963,7 @@ void bta_av_do_disc_a2d (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data) case BTA_AV_RS_OK: p_data = (tBTA_AV_DATA *)&p_scb->q_info.open; /* continue to open if link role is ok */ if (bta_av_link_role_ok(p_scb, A2D_SET_MULTL_BIT)) if (bta_av_link_role_ok(p_scb, A2DP_SET_MULTL_BIT)) { ok_continue = true; } Loading Loading @@ -1012,19 +1012,19 @@ void bta_av_do_disc_a2d (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data) if (p_scb->skip_sdp == true) { tA2D_Service a2d_ser; a2d_ser.avdt_version = AVDT_VERSION; tA2DP_Service a2dp_ser; a2dp_ser.avdt_version = AVDT_VERSION; p_scb->skip_sdp = false; p_scb->uuid_int = p_data->api_open.uuid; /* only one A2D find service is active at a time */ /* only one A2DP find service is active at a time */ bta_av_cb.handle = p_scb->hndl; APPL_TRACE_WARNING("%s: Skip Sdp for incoming A2dp connection", __func__); bta_av_a2d_sdp_cback(true, &a2d_ser); bta_av_a2dp_sdp_cback(true, &a2dp_ser); return; } /* only one A2D find service is active at a time */ /* only one A2DP find service is active at a time */ bta_av_cb.handle = p_scb->hndl; /* set up parameters */ Loading @@ -1040,13 +1040,13 @@ void bta_av_do_disc_a2d (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data) APPL_TRACE_DEBUG("%s: uuid_int 0x%x, Doing SDP For 0x%x", __func__, p_scb->uuid_int, sdp_uuid); if (A2D_FindService(sdp_uuid, p_scb->peer_addr, &db_params, bta_av_a2d_sdp_cback) == A2D_SUCCESS) if (A2DP_FindService(sdp_uuid, p_scb->peer_addr, &db_params, bta_av_a2dp_sdp_cback) == A2DP_SUCCESS) return; /* when the code reaches here, either the DB is NULL * or A2D_FindService is not successful */ bta_av_a2d_sdp_cback(false, NULL); * or A2DP_FindService is not successful */ bta_av_a2dp_sdp_cback(false, NULL); } /******************************************************************************* Loading Loading @@ -1096,7 +1096,7 @@ void bta_av_cleanup(tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data) if (p_scb->deregistring) { /* remove stream */ for (int i = 0; i < A2D_CODEC_SEP_INDEX_MAX; i++) { for (int i = 0; i < A2DP_CODEC_SEP_INDEX_MAX; i++) { if (p_scb->seps[i].av_handle) AVDT_RemoveStream(p_scb->seps[i].av_handle); p_scb->seps[i].av_handle = 0; Loading Loading @@ -1341,7 +1341,7 @@ void bta_av_setconfig_rsp (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data) p_scb->avdt_version = AVDT_VERSION_SYNC; if (A2D_GetCodecType(p_scb->cfg.codec_info) == A2D_MEDIA_CT_SBC || if (A2DP_GetCodecType(p_scb->cfg.codec_info) == A2DP_MEDIA_CT_SBC || num > 1) { /* if SBC is used by the SNK as INT, discover req is not sent in bta_av_config_ind. * call disc_res now */ Loading Loading @@ -1882,7 +1882,7 @@ void bta_av_getcap_results (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data) cfg.num_protect = p_scb->p_cap->num_protect; memcpy(cfg.codec_info, p_scb->p_cap->codec_info, AVDT_CODEC_SIZE); memcpy(cfg.protect_info, p_scb->p_cap->protect_info, AVDT_PROTECT_SIZE); media_type = A2D_GetMediaType(p_scb->p_cap->codec_info); media_type = A2DP_GetMediaType(p_scb->p_cap->codec_info); 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, Loading @@ -1898,7 +1898,7 @@ void bta_av_getcap_results (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data) (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) == A2D_SUCCESS)) { A2DP_SUCCESS)) { #if AVDT_MULTIPLEXING == TRUE cfg.mux_mask &= p_scb->p_cap->mux_mask; APPL_TRACE_DEBUG("%s: mux_mask used x%x", __func__, cfg.mux_mask); Loading Loading @@ -2112,12 +2112,12 @@ void bta_av_str_stopped (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data) L2CA_SetFlushTimeout(p_scb->peer_addr, L2CAP_DEFAULT_FLUSH_TO); } /* if q_info.a2d_list is not empty, drop it now */ /* if q_info.a2dp_list is not empty, drop it now */ if (BTA_AV_CHNL_AUDIO == p_scb->chnl) { while (!list_is_empty(p_scb->a2d_list)) while (!list_is_empty(p_scb->a2dp_list)) { p_buf = (BT_HDR *)list_front(p_scb->a2d_list); list_remove(p_scb->a2d_list, p_buf); p_buf = (BT_HDR *)list_front(p_scb->a2dp_list); list_remove(p_scb->a2dp_list, p_buf); osi_free(p_buf); } Loading Loading @@ -2247,7 +2247,7 @@ void bta_av_data_path (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data) BT_HDR *p_buf = NULL; uint32_t timestamp; bool new_buf = false; tA2D_CODEC_TYPE codec_type = A2D_GetCodecType(p_scb->cfg.codec_info); tA2DP_CODEC_TYPE codec_type = A2DP_GetCodecType(p_scb->cfg.codec_info); uint8_t m_pt = 0x60 | codec_type; tAVDT_DATA_OPT_MASK opt; UNUSED(p_data); Loading @@ -2258,16 +2258,16 @@ void bta_av_data_path (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data) //Always get the current number of bufs que'd up p_scb->l2c_bufs = (uint8_t)L2CA_FlushChannel (p_scb->l2c_cid, L2CAP_FLUSH_CHANS_GET); if (!list_is_empty(p_scb->a2d_list)) { p_buf = (BT_HDR *)list_front(p_scb->a2d_list); list_remove(p_scb->a2d_list, p_buf); /* use q_info.a2d data, read the timestamp */ if (!list_is_empty(p_scb->a2dp_list)) { p_buf = (BT_HDR *)list_front(p_scb->a2dp_list); list_remove(p_scb->a2dp_list, p_buf); /* use q_info.a2dp data, read the timestamp */ timestamp = *(uint32_t *)(p_buf + 1); } else { new_buf = true; /* a2d_list empty, call co_data, dup data to other channels */ /* A2DP_list empty, call co_data, dup data to other channels */ p_buf = (BT_HDR *)p_scb->p_cos->data(p_scb->cfg.codec_info, ×tamp); Loading Loading @@ -2307,18 +2307,18 @@ void bta_av_data_path (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data) { /* just got this buffer from co_data, * put it in queue */ list_append(p_scb->a2d_list, p_buf); list_append(p_scb->a2dp_list, p_buf); } else { /* just dequeue it from the a2d_list */ if (list_length(p_scb->a2d_list) < 3) { /* just dequeue it from the a2dp_list */ if (list_length(p_scb->a2dp_list) < 3) { /* put it back to the queue */ list_prepend(p_scb->a2d_list, p_buf); list_prepend(p_scb->a2dp_list, p_buf); } else { /* too many buffers in a2d_list, drop it. */ /* too many buffers in a2dp_list, drop it. */ bta_av_co_audio_drop(p_scb->hndl); osi_free(p_buf); } Loading Loading @@ -2392,7 +2392,7 @@ void bta_av_start_ok (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data) } } if (!bta_av_link_role_ok(p_scb, A2D_SET_ONE_BIT)) if (!bta_av_link_role_ok(p_scb, A2DP_SET_ONE_BIT)) p_scb->q_tag = BTA_AV_Q_TAG_START; else { Loading Loading @@ -3043,7 +3043,7 @@ void bta_av_open_rc (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data) if ((p_scb->wait & BTA_AV_WAIT_ROLE_SW_BITS) && (p_scb->q_tag == BTA_AV_Q_TAG_START)) { /* waiting for role switch for some reason & the timer expires */ if (!bta_av_link_role_ok(p_scb, A2D_SET_ONE_BIT)) if (!bta_av_link_role_ok(p_scb, A2DP_SET_ONE_BIT)) { APPL_TRACE_ERROR ("%s: failed to start streaming for role management reasons!!", __func__); Loading system/bta/av/bta_av_act.cc +13 −13 Original line number Diff line number Diff line Loading @@ -1926,7 +1926,7 @@ void bta_av_rc_disc_done(tBTA_AV_DATA *p_data) APPL_TRACE_DEBUG("%s rc_handle %d", __func__, rc_handle); #if (BTA_AV_SINK_INCLUDED == TRUE) if (p_cb->sdp_a2d_snk_handle) if (p_cb->sdp_a2dp_snk_handle) { /* This is Sink + CT + TG(Abs Vol) */ peer_features = bta_avk_check_peer_features(UUID_SERVCLASS_AV_REM_CTRL_TARGET); Loading @@ -1935,7 +1935,7 @@ void bta_av_rc_disc_done(tBTA_AV_DATA *p_data) } else #endif if (p_cb->sdp_a2d_handle) if (p_cb->sdp_a2dp_handle) { /* check peer version and whether support CT and TG role */ peer_features = bta_av_check_peer_features(UUID_SERVCLASS_AV_REMOTE_CONTROL); Loading Loading @@ -2257,11 +2257,11 @@ void bta_av_dereg_comp(tBTA_AV_DATA *p_data) } p_cb->conn_audio &= ~mask; if (p_scb->q_tag == BTA_AV_Q_TAG_STREAM && p_scb->a2d_list) { /* make sure no buffers are in a2d_list */ while (!list_is_empty(p_scb->a2d_list)) { p_buf = (BT_HDR*)list_front(p_scb->a2d_list); list_remove(p_scb->a2d_list, p_buf); if (p_scb->q_tag == BTA_AV_Q_TAG_STREAM && p_scb->a2dp_list) { /* make sure no buffers are in a2dp_list */ while (!list_is_empty(p_scb->a2dp_list)) { p_buf = (BT_HDR*)list_front(p_scb->a2dp_list); list_remove(p_scb->a2dp_list, p_buf); osi_free(p_buf); } } Loading @@ -2272,18 +2272,18 @@ void bta_av_dereg_comp(tBTA_AV_DATA *p_data) #if (BTA_AR_INCLUDED == TRUE) bta_ar_dereg_avrc (UUID_SERVCLASS_AV_REMOTE_CONTROL, BTA_ID_AV); #endif if (p_cb->sdp_a2d_handle) if (p_cb->sdp_a2dp_handle) { bta_av_del_sdp_rec(&p_cb->sdp_a2d_handle); p_cb->sdp_a2d_handle = 0; bta_av_del_sdp_rec(&p_cb->sdp_a2dp_handle); p_cb->sdp_a2dp_handle = 0; bta_sys_remove_uuid(UUID_SERVCLASS_AUDIO_SOURCE); } #if (BTA_AV_SINK_INCLUDED == TRUE) if (p_cb->sdp_a2d_snk_handle) if (p_cb->sdp_a2dp_snk_handle) { bta_av_del_sdp_rec(&p_cb->sdp_a2d_snk_handle); p_cb->sdp_a2d_snk_handle = 0; bta_av_del_sdp_rec(&p_cb->sdp_a2dp_snk_handle); p_cb->sdp_a2dp_snk_handle = 0; bta_sys_remove_uuid(UUID_SERVCLASS_AUDIO_SINK); } #endif Loading system/bta/av/bta_av_ci.cc +1 −1 Original line number Diff line number Diff line Loading @@ -71,7 +71,7 @@ void bta_av_ci_setconfig(tBTA_AV_HNDL hndl, uint8_t err_code, uint8_t category, (tBTA_AV_CI_SETCONFIG *)osi_malloc(sizeof(tBTA_AV_CI_SETCONFIG)); p_buf->hdr.layer_specific = hndl; p_buf->hdr.event = (err_code == A2D_SUCCESS) ? p_buf->hdr.event = (err_code == A2DP_SUCCESS) ? BTA_AV_CI_SETCONFIG_OK_EVT : BTA_AV_CI_SETCONFIG_FAIL_EVT; p_buf->err_code = err_code; p_buf->category = category; Loading system/bta/av/bta_av_int.h +15 −15 Original line number Diff line number Diff line Loading @@ -30,7 +30,7 @@ #include "bta_av_api.h" #include "avdt_api.h" #include "bta_av_co.h" #include "stack/include/a2d_api.h" #include "stack/include/a2dp_api.h" #define BTA_AV_DEBUG TRUE /***************************************************************************** Loading Loading @@ -153,12 +153,12 @@ enum *****************************************************************************/ /* function types for call-out functions */ typedef bool (*tBTA_AV_CO_INIT) (tA2D_CODEC_SEP_INDEX codec_sep_index, typedef bool (*tBTA_AV_CO_INIT) (tA2DP_CODEC_SEP_INDEX codec_sep_index, tAVDT_CFG *p_cfg); typedef void (*tBTA_AV_CO_DISC_RES) (tBTA_AV_HNDL hndl, uint8_t num_seps, uint8_t num_snk, uint8_t num_src, BD_ADDR addr, uint16_t uuid_local); typedef tA2D_STATUS (*tBTA_AV_CO_GETCFG) (tBTA_AV_HNDL hndl, typedef tA2DP_STATUS (*tBTA_AV_CO_GETCFG) (tBTA_AV_HNDL hndl, uint8_t *p_codec_info, uint8_t *p_sep_info_idx, uint8_t seid, Loading Loading @@ -465,9 +465,9 @@ typedef struct const tBTA_AV_ACT *p_act_tbl; /* the action table for stream state machine */ const tBTA_AV_CO_FUNCTS *p_cos; /* the associated callout functions */ bool sdp_discovery_started; /* variable to determine whether SDP is started */ tBTA_AV_SEP seps[A2D_CODEC_SEP_INDEX_MAX]; tBTA_AV_SEP seps[A2DP_CODEC_SEP_INDEX_MAX]; tAVDT_CFG *p_cap; /* buffer used for get capabilities */ list_t *a2d_list; /* used for audio channels only */ list_t *a2dp_list; /* used for audio channels only */ tBTA_AV_Q_INFO q_info; tAVDT_SEP_INFO sep_info[BTA_AV_NUM_SEPS]; /* stream discovery results */ tAVDT_CFG cfg; /* local SEP configuration */ Loading Loading @@ -561,8 +561,8 @@ typedef struct tBTA_AV_LCB lcb[BTA_AV_NUM_LINKS+1]; /* link control block */ alarm_t *link_signalling_timer; alarm_t *accept_signalling_timer; /* timer to monitor signalling when accepting */ uint32_t sdp_a2d_handle; /* SDP record handle for audio src */ uint32_t sdp_a2d_snk_handle; /* SDP record handle for audio snk */ uint32_t sdp_a2dp_handle; /* SDP record handle for audio src */ uint32_t sdp_a2dp_snk_handle; /* SDP record handle for audio snk */ uint32_t sdp_vdp_handle; /* SDP record handle for video src */ tBTA_AV_FEAT features; /* features mask */ tBTA_SEC sec_mask; /* security mask */ Loading Loading @@ -603,8 +603,8 @@ extern const tBTA_AV_CFG bta_av_cfg; extern uint16_t *p_bta_av_rc_id; extern uint16_t *p_bta_av_rc_id_ac; extern const tBTA_AV_SACT bta_av_a2d_action[]; extern const tBTA_AV_CO_FUNCTS bta_av_a2d_cos; extern const tBTA_AV_SACT bta_av_a2dp_action[]; extern const tBTA_AV_CO_FUNCTS bta_av_a2dp_cos; extern tAVDT_CTRL_CBACK * const bta_av_dt_cback[]; extern void bta_av_sink_data_cback(uint8_t handle, BT_HDR *p_pkt, uint32_t time_stamp, uint8_t m_pt); Loading Loading @@ -669,7 +669,7 @@ extern tBTA_AV_RCB * bta_av_get_rcb_by_shdl(uint8_t shdl); extern void bta_av_del_rc(tBTA_AV_RCB *p_rcb); /* ssm action functions */ extern void bta_av_do_disc_a2d (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data); extern void bta_av_do_disc_a2dp(tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data); extern void bta_av_cleanup (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data); extern void bta_av_free_sdb (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data); extern void bta_av_config_ind (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data); Loading system/bta/av/bta_av_main.cc +27 −24 Original line number Diff line number Diff line Loading @@ -346,7 +346,7 @@ static tBTA_AV_SCB * bta_av_alloc_scb(tBTA_AV_CHNL chnl) p_ret->chnl = chnl; p_ret->hndl = (tBTA_AV_HNDL)((xx + 1) | chnl); p_ret->hdi = xx; p_ret->a2d_list = list_new(NULL); p_ret->a2dp_list = list_new(NULL); p_ret->avrc_ct_timer = alarm_new("bta_av.avrc_ct_timer"); bta_av_cb.p_scb[xx] = p_ret; break; Loading Loading @@ -550,14 +550,14 @@ static void bta_av_api_register(tBTA_AV_DATA *p_data) if(registr.chnl == BTA_AV_CHNL_AUDIO) { /* set up the audio stream control block */ p_scb->p_act_tbl = (const tBTA_AV_ACT *)bta_av_a2d_action; p_scb->p_cos = &bta_av_a2d_cos; p_scb->p_act_tbl = (const tBTA_AV_ACT *)bta_av_a2dp_action; p_scb->p_cos = &bta_av_a2dp_cos; p_scb->media_type= AVDT_MEDIA_TYPE_AUDIO; cs.cfg.psc_mask = AVDT_PSC_TRANS; cs.media_type = AVDT_MEDIA_TYPE_AUDIO; cs.mtu = p_bta_av_cfg->audio_mtu; cs.flush_to = L2CAP_DEFAULT_FLUSH_TO; tA2D_CODEC_SEP_INDEX codec_sep_index = A2D_CODEC_SEP_INDEX_SBC; tA2DP_CODEC_SEP_INDEX codec_sep_index = A2DP_CODEC_SEP_INDEX_SBC; #if (AVDT_REPORTING == TRUE) if(bta_av_cb.features & BTA_AV_FEAT_REPORT) Loading @@ -575,24 +575,24 @@ static void bta_av_api_register(tBTA_AV_DATA *p_data) if (profile_initialized == UUID_SERVCLASS_AUDIO_SOURCE) { cs.tsep = AVDT_TSEP_SRC; codec_sep_index = A2D_CODEC_SEP_INDEX_SBC; codec_sep_index = A2DP_CODEC_SEP_INDEX_SBC; } else if (profile_initialized == UUID_SERVCLASS_AUDIO_SINK) { cs.tsep = AVDT_TSEP_SNK; cs.p_sink_data_cback = bta_av_sink_data_cback; codec_sep_index = A2D_CODEC_SEP_INDEX_SBC_SINK; codec_sep_index = A2DP_CODEC_SEP_INDEX_SBC_SINK; } /* Initialize handles to zero */ for (int xx = 0; xx < A2D_CODEC_SEP_INDEX_MAX; xx++) for (int xx = 0; xx < A2DP_CODEC_SEP_INDEX_MAX; xx++) { p_scb->seps[xx].av_handle = 0; } /* keep the configuration in the stream control block */ memcpy(&p_scb->cfg, &cs.cfg, sizeof(tAVDT_CFG)); if ((*bta_av_a2d_cos.init)(codec_sep_index, &cs.cfg)) { if ((*bta_av_a2dp_cos.init)(codec_sep_index, &cs.cfg)) { if (AVDT_CreateStream(&p_scb->seps[codec_sep_index].av_handle, &cs) == AVDT_SUCCESS) { /* Save a copy of the codec */ Loading @@ -613,22 +613,24 @@ static void bta_av_api_register(tBTA_AV_DATA *p_data) if(!bta_av_cb.reg_audio) { bta_av_cb.sdp_a2d_handle = 0; bta_av_cb.sdp_a2d_snk_handle = 0; bta_av_cb.sdp_a2dp_handle = 0; bta_av_cb.sdp_a2dp_snk_handle = 0; if (profile_initialized == UUID_SERVCLASS_AUDIO_SOURCE) { /* create the SDP records on the 1st audio channel */ bta_av_cb.sdp_a2d_handle = SDP_CreateRecord(); A2D_AddRecord(UUID_SERVCLASS_AUDIO_SOURCE, p_service_name, NULL, A2D_SUPF_PLAYER, bta_av_cb.sdp_a2d_handle); bta_av_cb.sdp_a2dp_handle = SDP_CreateRecord(); A2DP_AddRecord(UUID_SERVCLASS_AUDIO_SOURCE, p_service_name, NULL, A2DP_SUPF_PLAYER, bta_av_cb.sdp_a2dp_handle); bta_sys_add_uuid(UUID_SERVCLASS_AUDIO_SOURCE); } else if (profile_initialized == UUID_SERVCLASS_AUDIO_SINK) { #if (BTA_AV_SINK_INCLUDED == TRUE) bta_av_cb.sdp_a2d_snk_handle = SDP_CreateRecord(); A2D_AddRecord(UUID_SERVCLASS_AUDIO_SINK, p_service_name, NULL, A2D_SUPF_PLAYER, bta_av_cb.sdp_a2d_snk_handle); bta_av_cb.sdp_a2dp_snk_handle = SDP_CreateRecord(); A2DP_AddRecord(UUID_SERVCLASS_AUDIO_SINK, p_service_name, NULL, A2DP_SUPF_PLAYER, bta_av_cb.sdp_a2dp_snk_handle); bta_sys_add_uuid(UUID_SERVCLASS_AUDIO_SINK); #endif } Loading Loading @@ -918,7 +920,7 @@ static void bta_av_sys_rs_cback (tBTA_SYS_CONN_STATUS status,uint8_t id, uint8_t p_scb->q_info.open.switch_res = BTA_AV_RS_FAIL; /* Continue av open process */ bta_av_do_disc_a2d (p_scb, (tBTA_AV_DATA *)&(p_scb->q_info.open)); bta_av_do_disc_a2dp(p_scb, (tBTA_AV_DATA *)&(p_scb->q_info.open)); } bta_av_cb.rs_idx = 0; Loading Loading @@ -1054,8 +1056,9 @@ bool bta_av_link_role_ok(tBTA_AV_SCB *p_scb, uint8_t bits) LOG_INFO(LOG_TAG, "%s hndl:x%x role:%d conn_audio:x%x bits:%d features:x%x", __func__, p_scb->hndl, role, bta_av_cb.conn_audio, bits, bta_av_cb.features); if (BTM_ROLE_MASTER != role && (A2D_BitsSet(bta_av_cb.conn_audio) > bits || (bta_av_cb.features & BTA_AV_FEAT_MASTER))) { if (BTM_ROLE_MASTER != role && (A2DP_BitsSet(bta_av_cb.conn_audio) > bits || (bta_av_cb.features & BTA_AV_FEAT_MASTER))) { if (bta_av_cb.features & BTA_AV_FEAT_MASTER) bta_sys_clear_policy(BTA_ID_AV, HCI_ENABLE_MASTER_SLAVE_SWITCH, p_scb->peer_addr); Loading Loading @@ -1122,7 +1125,7 @@ uint16_t bta_av_chk_mtu(tBTA_AV_SCB *p_scb, uint16_t mtu) ** ** Function bta_av_dup_audio_buf ** ** Description dup the audio data to the q_info.a2d of other audio channels ** Description dup the audio data to the q_info.a2dp of other audio channels ** ** Returns void ** Loading @@ -1147,13 +1150,13 @@ void bta_av_dup_audio_buf(tBTA_AV_SCB *p_scb, BT_HDR *p_buf) /* Enqueue the data */ BT_HDR *p_new = (BT_HDR *)osi_malloc(copy_size); memcpy(p_new, p_buf, copy_size); list_append(p_scbi->a2d_list, p_new); list_append(p_scbi->a2dp_list, p_new); if (list_length(p_scbi->a2d_list) > p_bta_av_cfg->audio_mqs) { if (list_length(p_scbi->a2dp_list) > p_bta_av_cfg->audio_mqs) { // Drop the oldest packet bta_av_co_audio_drop(p_scbi->hndl); BT_HDR *p_buf_drop = static_cast<BT_HDR *>(list_front(p_scbi->a2d_list)); list_remove(p_scbi->a2d_list, p_buf_drop); BT_HDR *p_buf_drop = static_cast<BT_HDR *>(list_front(p_scbi->a2dp_list)); list_remove(p_scbi->a2dp_list, p_buf_drop); osi_free(p_buf_drop); } } Loading Loading
system/bta/av/bta_av_aact.cc +55 −55 Original line number Diff line number Diff line Loading @@ -82,7 +82,7 @@ enum /* the call out functions for audio stream */ const tBTA_AV_CO_FUNCTS bta_av_a2d_cos = const tBTA_AV_CO_FUNCTS bta_av_a2dp_cos = { bta_av_co_audio_init, bta_av_co_audio_disc_res, Loading @@ -97,9 +97,9 @@ const tBTA_AV_CO_FUNCTS bta_av_a2d_cos = }; /* ssm action functions for audio stream */ const tBTA_AV_SACT bta_av_a2d_action[] = const tBTA_AV_SACT bta_av_a2dp_action[] = { bta_av_do_disc_a2d, /* BTA_AV_DO_DISC */ bta_av_do_disc_a2dp, /* BTA_AV_DO_DISC */ bta_av_cleanup, /* BTA_AV_CLEANUP */ bta_av_free_sdb, /* BTA_AV_FREE_SDB */ bta_av_config_ind, /* BTA_AV_CONFIG_IND */ Loading Loading @@ -250,9 +250,9 @@ tAVDT_CTRL_CBACK * const bta_av_dt_cback[] = ***********************************************/ static uint8_t bta_av_get_scb_handle(tBTA_AV_SCB *p_scb, uint8_t local_sep) { for (int i = 0; i < A2D_CODEC_SEP_INDEX_MAX; i++) { for (int i = 0; i < A2DP_CODEC_SEP_INDEX_MAX; i++) { if ((p_scb->seps[i].tsep == local_sep) && A2D_CodecTypeEquals(p_scb->seps[i].codec_info, A2DP_CodecTypeEquals(p_scb->seps[i].codec_info, p_scb->cfg.codec_info)) { return (p_scb->seps[i].av_handle); } Loading @@ -272,7 +272,7 @@ static uint8_t bta_av_get_scb_handle(tBTA_AV_SCB *p_scb, uint8_t local_sep) ***********************************************/ static uint8_t bta_av_get_scb_sep_type(tBTA_AV_SCB *p_scb, uint8_t tavdt_handle) { for (int i = 0; i < A2D_CODEC_SEP_INDEX_MAX; i++) { for (int i = 0; i < A2DP_CODEC_SEP_INDEX_MAX; i++) { if (p_scb->seps[i].av_handle == tavdt_handle) return (p_scb->seps[i].tsep); } Loading Loading @@ -704,14 +704,14 @@ static void bta_av_stream5_cback(uint8_t handle, BD_ADDR bd_addr, uint8_t event, /******************************************************************************* ** ** Function bta_av_a2d_sdp_cback ** Function bta_av_a2dp_sdp_cback ** ** Description A2DP service discovery callback. ** ** Returns void ** *******************************************************************************/ static void bta_av_a2d_sdp_cback(bool found, tA2D_Service *p_service) static void bta_av_a2dp_sdp_cback(bool found, tA2DP_Service *p_service) { tBTA_AV_SCB *p_scb = bta_av_hndl_to_scb(bta_av_cb.handle); Loading Loading @@ -746,14 +746,14 @@ static void bta_av_a2d_sdp_cback(bool found, tA2D_Service *p_service) static void bta_av_adjust_seps_idx(tBTA_AV_SCB *p_scb, uint8_t avdt_handle) { APPL_TRACE_DEBUG("%s: codec: %s", __func__, A2D_CodecName(p_scb->cfg.codec_info)); for (int i = 0; i < A2D_CODEC_SEP_INDEX_MAX; i++) { A2DP_CodecName(p_scb->cfg.codec_info)); for (int i = 0; i < A2DP_CODEC_SEP_INDEX_MAX; i++) { APPL_TRACE_DEBUG("%s: av_handle: %d codec: %d", __func__, p_scb->seps[i].av_handle, A2D_CodecName(p_scb->seps[i].codec_info)); A2DP_CodecName(p_scb->seps[i].codec_info)); if (p_scb->seps[i].av_handle && (p_scb->seps[i].av_handle == avdt_handle) && A2D_CodecTypeEquals(p_scb->seps[i].codec_info, A2DP_CodecTypeEquals(p_scb->seps[i].codec_info, p_scb->cfg.codec_info)) { p_scb->sep_idx = i; p_scb->avdt_handle = p_scb->seps[i].av_handle; Loading Loading @@ -787,14 +787,14 @@ void bta_av_switch_role (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data) if (p_scb->q_tag == BTA_AV_Q_TAG_OPEN) { if (bta_av_switch_if_needed(p_scb) || !bta_av_link_role_ok(p_scb, A2D_SET_MULTL_BIT)) { if (bta_av_switch_if_needed(p_scb) || !bta_av_link_role_ok(p_scb, A2DP_SET_MULTL_BIT)) { p_scb->wait |= BTA_AV_WAIT_ROLE_SW_RES_OPEN; } else { /* this should not happen in theory. Just in case... * continue to do_disc_a2d */ * continue to do_disc_a2dp */ switch_res = BTA_AV_RS_DONE; } } Loading @@ -813,7 +813,7 @@ void bta_av_switch_role (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data) p_scb->wait &= ~BTA_AV_WAIT_ROLE_SW_RETRY; p_scb->q_tag = 0; p_buf->switch_res = switch_res; bta_av_do_disc_a2d(p_scb, (tBTA_AV_DATA *)p_buf); bta_av_do_disc_a2dp(p_scb, (tBTA_AV_DATA *)p_buf); } } Loading Loading @@ -886,7 +886,7 @@ void bta_av_role_res (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data) { /* Continue av open process */ p_scb->q_info.open.switch_res = BTA_AV_RS_DONE; bta_av_do_disc_a2d (p_scb, (tBTA_AV_DATA *)&(p_scb->q_info.open)); bta_av_do_disc_a2dp(p_scb, (tBTA_AV_DATA *)&(p_scb->q_info.open)); } } else Loading Loading @@ -917,17 +917,17 @@ void bta_av_delay_co (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data) /******************************************************************************* ** ** Function bta_av_do_disc_a2d ** Function bta_av_do_disc_a2dp ** ** Description Do service discovery for A2DP. ** ** Returns void ** *******************************************************************************/ void bta_av_do_disc_a2d (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data) void bta_av_do_disc_a2dp(tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data) { bool ok_continue = false; tA2D_SDP_DB_PARAMS db_params; tA2DP_SDP_DB_PARAMS db_params; uint16_t attr_list[] = {ATTR_ID_SERVICE_CLASS_ID_LIST, ATTR_ID_PROTOCOL_DESC_LIST, ATTR_ID_BT_PROFILE_DESC_LIST}; Loading @@ -941,8 +941,8 @@ void bta_av_do_disc_a2d (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data) switch(p_data->api_open.switch_res) { case BTA_AV_RS_NONE: if (bta_av_switch_if_needed(p_scb) || !bta_av_link_role_ok(p_scb, A2D_SET_MULTL_BIT)) { if (bta_av_switch_if_needed(p_scb) || !bta_av_link_role_ok(p_scb, A2DP_SET_MULTL_BIT)) { /* waiting for role switch result. save the api to control block */ memcpy(&p_scb->q_info.open, &p_data->api_open, sizeof(tBTA_AV_API_OPEN)); p_scb->wait |= BTA_AV_WAIT_ROLE_SW_RES_OPEN; Loading @@ -963,7 +963,7 @@ void bta_av_do_disc_a2d (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data) case BTA_AV_RS_OK: p_data = (tBTA_AV_DATA *)&p_scb->q_info.open; /* continue to open if link role is ok */ if (bta_av_link_role_ok(p_scb, A2D_SET_MULTL_BIT)) if (bta_av_link_role_ok(p_scb, A2DP_SET_MULTL_BIT)) { ok_continue = true; } Loading Loading @@ -1012,19 +1012,19 @@ void bta_av_do_disc_a2d (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data) if (p_scb->skip_sdp == true) { tA2D_Service a2d_ser; a2d_ser.avdt_version = AVDT_VERSION; tA2DP_Service a2dp_ser; a2dp_ser.avdt_version = AVDT_VERSION; p_scb->skip_sdp = false; p_scb->uuid_int = p_data->api_open.uuid; /* only one A2D find service is active at a time */ /* only one A2DP find service is active at a time */ bta_av_cb.handle = p_scb->hndl; APPL_TRACE_WARNING("%s: Skip Sdp for incoming A2dp connection", __func__); bta_av_a2d_sdp_cback(true, &a2d_ser); bta_av_a2dp_sdp_cback(true, &a2dp_ser); return; } /* only one A2D find service is active at a time */ /* only one A2DP find service is active at a time */ bta_av_cb.handle = p_scb->hndl; /* set up parameters */ Loading @@ -1040,13 +1040,13 @@ void bta_av_do_disc_a2d (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data) APPL_TRACE_DEBUG("%s: uuid_int 0x%x, Doing SDP For 0x%x", __func__, p_scb->uuid_int, sdp_uuid); if (A2D_FindService(sdp_uuid, p_scb->peer_addr, &db_params, bta_av_a2d_sdp_cback) == A2D_SUCCESS) if (A2DP_FindService(sdp_uuid, p_scb->peer_addr, &db_params, bta_av_a2dp_sdp_cback) == A2DP_SUCCESS) return; /* when the code reaches here, either the DB is NULL * or A2D_FindService is not successful */ bta_av_a2d_sdp_cback(false, NULL); * or A2DP_FindService is not successful */ bta_av_a2dp_sdp_cback(false, NULL); } /******************************************************************************* Loading Loading @@ -1096,7 +1096,7 @@ void bta_av_cleanup(tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data) if (p_scb->deregistring) { /* remove stream */ for (int i = 0; i < A2D_CODEC_SEP_INDEX_MAX; i++) { for (int i = 0; i < A2DP_CODEC_SEP_INDEX_MAX; i++) { if (p_scb->seps[i].av_handle) AVDT_RemoveStream(p_scb->seps[i].av_handle); p_scb->seps[i].av_handle = 0; Loading Loading @@ -1341,7 +1341,7 @@ void bta_av_setconfig_rsp (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data) p_scb->avdt_version = AVDT_VERSION_SYNC; if (A2D_GetCodecType(p_scb->cfg.codec_info) == A2D_MEDIA_CT_SBC || if (A2DP_GetCodecType(p_scb->cfg.codec_info) == A2DP_MEDIA_CT_SBC || num > 1) { /* if SBC is used by the SNK as INT, discover req is not sent in bta_av_config_ind. * call disc_res now */ Loading Loading @@ -1882,7 +1882,7 @@ void bta_av_getcap_results (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data) cfg.num_protect = p_scb->p_cap->num_protect; memcpy(cfg.codec_info, p_scb->p_cap->codec_info, AVDT_CODEC_SIZE); memcpy(cfg.protect_info, p_scb->p_cap->protect_info, AVDT_PROTECT_SIZE); media_type = A2D_GetMediaType(p_scb->p_cap->codec_info); media_type = A2DP_GetMediaType(p_scb->p_cap->codec_info); 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, Loading @@ -1898,7 +1898,7 @@ void bta_av_getcap_results (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data) (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) == A2D_SUCCESS)) { A2DP_SUCCESS)) { #if AVDT_MULTIPLEXING == TRUE cfg.mux_mask &= p_scb->p_cap->mux_mask; APPL_TRACE_DEBUG("%s: mux_mask used x%x", __func__, cfg.mux_mask); Loading Loading @@ -2112,12 +2112,12 @@ void bta_av_str_stopped (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data) L2CA_SetFlushTimeout(p_scb->peer_addr, L2CAP_DEFAULT_FLUSH_TO); } /* if q_info.a2d_list is not empty, drop it now */ /* if q_info.a2dp_list is not empty, drop it now */ if (BTA_AV_CHNL_AUDIO == p_scb->chnl) { while (!list_is_empty(p_scb->a2d_list)) while (!list_is_empty(p_scb->a2dp_list)) { p_buf = (BT_HDR *)list_front(p_scb->a2d_list); list_remove(p_scb->a2d_list, p_buf); p_buf = (BT_HDR *)list_front(p_scb->a2dp_list); list_remove(p_scb->a2dp_list, p_buf); osi_free(p_buf); } Loading Loading @@ -2247,7 +2247,7 @@ void bta_av_data_path (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data) BT_HDR *p_buf = NULL; uint32_t timestamp; bool new_buf = false; tA2D_CODEC_TYPE codec_type = A2D_GetCodecType(p_scb->cfg.codec_info); tA2DP_CODEC_TYPE codec_type = A2DP_GetCodecType(p_scb->cfg.codec_info); uint8_t m_pt = 0x60 | codec_type; tAVDT_DATA_OPT_MASK opt; UNUSED(p_data); Loading @@ -2258,16 +2258,16 @@ void bta_av_data_path (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data) //Always get the current number of bufs que'd up p_scb->l2c_bufs = (uint8_t)L2CA_FlushChannel (p_scb->l2c_cid, L2CAP_FLUSH_CHANS_GET); if (!list_is_empty(p_scb->a2d_list)) { p_buf = (BT_HDR *)list_front(p_scb->a2d_list); list_remove(p_scb->a2d_list, p_buf); /* use q_info.a2d data, read the timestamp */ if (!list_is_empty(p_scb->a2dp_list)) { p_buf = (BT_HDR *)list_front(p_scb->a2dp_list); list_remove(p_scb->a2dp_list, p_buf); /* use q_info.a2dp data, read the timestamp */ timestamp = *(uint32_t *)(p_buf + 1); } else { new_buf = true; /* a2d_list empty, call co_data, dup data to other channels */ /* A2DP_list empty, call co_data, dup data to other channels */ p_buf = (BT_HDR *)p_scb->p_cos->data(p_scb->cfg.codec_info, ×tamp); Loading Loading @@ -2307,18 +2307,18 @@ void bta_av_data_path (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data) { /* just got this buffer from co_data, * put it in queue */ list_append(p_scb->a2d_list, p_buf); list_append(p_scb->a2dp_list, p_buf); } else { /* just dequeue it from the a2d_list */ if (list_length(p_scb->a2d_list) < 3) { /* just dequeue it from the a2dp_list */ if (list_length(p_scb->a2dp_list) < 3) { /* put it back to the queue */ list_prepend(p_scb->a2d_list, p_buf); list_prepend(p_scb->a2dp_list, p_buf); } else { /* too many buffers in a2d_list, drop it. */ /* too many buffers in a2dp_list, drop it. */ bta_av_co_audio_drop(p_scb->hndl); osi_free(p_buf); } Loading Loading @@ -2392,7 +2392,7 @@ void bta_av_start_ok (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data) } } if (!bta_av_link_role_ok(p_scb, A2D_SET_ONE_BIT)) if (!bta_av_link_role_ok(p_scb, A2DP_SET_ONE_BIT)) p_scb->q_tag = BTA_AV_Q_TAG_START; else { Loading Loading @@ -3043,7 +3043,7 @@ void bta_av_open_rc (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data) if ((p_scb->wait & BTA_AV_WAIT_ROLE_SW_BITS) && (p_scb->q_tag == BTA_AV_Q_TAG_START)) { /* waiting for role switch for some reason & the timer expires */ if (!bta_av_link_role_ok(p_scb, A2D_SET_ONE_BIT)) if (!bta_av_link_role_ok(p_scb, A2DP_SET_ONE_BIT)) { APPL_TRACE_ERROR ("%s: failed to start streaming for role management reasons!!", __func__); Loading
system/bta/av/bta_av_act.cc +13 −13 Original line number Diff line number Diff line Loading @@ -1926,7 +1926,7 @@ void bta_av_rc_disc_done(tBTA_AV_DATA *p_data) APPL_TRACE_DEBUG("%s rc_handle %d", __func__, rc_handle); #if (BTA_AV_SINK_INCLUDED == TRUE) if (p_cb->sdp_a2d_snk_handle) if (p_cb->sdp_a2dp_snk_handle) { /* This is Sink + CT + TG(Abs Vol) */ peer_features = bta_avk_check_peer_features(UUID_SERVCLASS_AV_REM_CTRL_TARGET); Loading @@ -1935,7 +1935,7 @@ void bta_av_rc_disc_done(tBTA_AV_DATA *p_data) } else #endif if (p_cb->sdp_a2d_handle) if (p_cb->sdp_a2dp_handle) { /* check peer version and whether support CT and TG role */ peer_features = bta_av_check_peer_features(UUID_SERVCLASS_AV_REMOTE_CONTROL); Loading Loading @@ -2257,11 +2257,11 @@ void bta_av_dereg_comp(tBTA_AV_DATA *p_data) } p_cb->conn_audio &= ~mask; if (p_scb->q_tag == BTA_AV_Q_TAG_STREAM && p_scb->a2d_list) { /* make sure no buffers are in a2d_list */ while (!list_is_empty(p_scb->a2d_list)) { p_buf = (BT_HDR*)list_front(p_scb->a2d_list); list_remove(p_scb->a2d_list, p_buf); if (p_scb->q_tag == BTA_AV_Q_TAG_STREAM && p_scb->a2dp_list) { /* make sure no buffers are in a2dp_list */ while (!list_is_empty(p_scb->a2dp_list)) { p_buf = (BT_HDR*)list_front(p_scb->a2dp_list); list_remove(p_scb->a2dp_list, p_buf); osi_free(p_buf); } } Loading @@ -2272,18 +2272,18 @@ void bta_av_dereg_comp(tBTA_AV_DATA *p_data) #if (BTA_AR_INCLUDED == TRUE) bta_ar_dereg_avrc (UUID_SERVCLASS_AV_REMOTE_CONTROL, BTA_ID_AV); #endif if (p_cb->sdp_a2d_handle) if (p_cb->sdp_a2dp_handle) { bta_av_del_sdp_rec(&p_cb->sdp_a2d_handle); p_cb->sdp_a2d_handle = 0; bta_av_del_sdp_rec(&p_cb->sdp_a2dp_handle); p_cb->sdp_a2dp_handle = 0; bta_sys_remove_uuid(UUID_SERVCLASS_AUDIO_SOURCE); } #if (BTA_AV_SINK_INCLUDED == TRUE) if (p_cb->sdp_a2d_snk_handle) if (p_cb->sdp_a2dp_snk_handle) { bta_av_del_sdp_rec(&p_cb->sdp_a2d_snk_handle); p_cb->sdp_a2d_snk_handle = 0; bta_av_del_sdp_rec(&p_cb->sdp_a2dp_snk_handle); p_cb->sdp_a2dp_snk_handle = 0; bta_sys_remove_uuid(UUID_SERVCLASS_AUDIO_SINK); } #endif Loading
system/bta/av/bta_av_ci.cc +1 −1 Original line number Diff line number Diff line Loading @@ -71,7 +71,7 @@ void bta_av_ci_setconfig(tBTA_AV_HNDL hndl, uint8_t err_code, uint8_t category, (tBTA_AV_CI_SETCONFIG *)osi_malloc(sizeof(tBTA_AV_CI_SETCONFIG)); p_buf->hdr.layer_specific = hndl; p_buf->hdr.event = (err_code == A2D_SUCCESS) ? p_buf->hdr.event = (err_code == A2DP_SUCCESS) ? BTA_AV_CI_SETCONFIG_OK_EVT : BTA_AV_CI_SETCONFIG_FAIL_EVT; p_buf->err_code = err_code; p_buf->category = category; Loading
system/bta/av/bta_av_int.h +15 −15 Original line number Diff line number Diff line Loading @@ -30,7 +30,7 @@ #include "bta_av_api.h" #include "avdt_api.h" #include "bta_av_co.h" #include "stack/include/a2d_api.h" #include "stack/include/a2dp_api.h" #define BTA_AV_DEBUG TRUE /***************************************************************************** Loading Loading @@ -153,12 +153,12 @@ enum *****************************************************************************/ /* function types for call-out functions */ typedef bool (*tBTA_AV_CO_INIT) (tA2D_CODEC_SEP_INDEX codec_sep_index, typedef bool (*tBTA_AV_CO_INIT) (tA2DP_CODEC_SEP_INDEX codec_sep_index, tAVDT_CFG *p_cfg); typedef void (*tBTA_AV_CO_DISC_RES) (tBTA_AV_HNDL hndl, uint8_t num_seps, uint8_t num_snk, uint8_t num_src, BD_ADDR addr, uint16_t uuid_local); typedef tA2D_STATUS (*tBTA_AV_CO_GETCFG) (tBTA_AV_HNDL hndl, typedef tA2DP_STATUS (*tBTA_AV_CO_GETCFG) (tBTA_AV_HNDL hndl, uint8_t *p_codec_info, uint8_t *p_sep_info_idx, uint8_t seid, Loading Loading @@ -465,9 +465,9 @@ typedef struct const tBTA_AV_ACT *p_act_tbl; /* the action table for stream state machine */ const tBTA_AV_CO_FUNCTS *p_cos; /* the associated callout functions */ bool sdp_discovery_started; /* variable to determine whether SDP is started */ tBTA_AV_SEP seps[A2D_CODEC_SEP_INDEX_MAX]; tBTA_AV_SEP seps[A2DP_CODEC_SEP_INDEX_MAX]; tAVDT_CFG *p_cap; /* buffer used for get capabilities */ list_t *a2d_list; /* used for audio channels only */ list_t *a2dp_list; /* used for audio channels only */ tBTA_AV_Q_INFO q_info; tAVDT_SEP_INFO sep_info[BTA_AV_NUM_SEPS]; /* stream discovery results */ tAVDT_CFG cfg; /* local SEP configuration */ Loading Loading @@ -561,8 +561,8 @@ typedef struct tBTA_AV_LCB lcb[BTA_AV_NUM_LINKS+1]; /* link control block */ alarm_t *link_signalling_timer; alarm_t *accept_signalling_timer; /* timer to monitor signalling when accepting */ uint32_t sdp_a2d_handle; /* SDP record handle for audio src */ uint32_t sdp_a2d_snk_handle; /* SDP record handle for audio snk */ uint32_t sdp_a2dp_handle; /* SDP record handle for audio src */ uint32_t sdp_a2dp_snk_handle; /* SDP record handle for audio snk */ uint32_t sdp_vdp_handle; /* SDP record handle for video src */ tBTA_AV_FEAT features; /* features mask */ tBTA_SEC sec_mask; /* security mask */ Loading Loading @@ -603,8 +603,8 @@ extern const tBTA_AV_CFG bta_av_cfg; extern uint16_t *p_bta_av_rc_id; extern uint16_t *p_bta_av_rc_id_ac; extern const tBTA_AV_SACT bta_av_a2d_action[]; extern const tBTA_AV_CO_FUNCTS bta_av_a2d_cos; extern const tBTA_AV_SACT bta_av_a2dp_action[]; extern const tBTA_AV_CO_FUNCTS bta_av_a2dp_cos; extern tAVDT_CTRL_CBACK * const bta_av_dt_cback[]; extern void bta_av_sink_data_cback(uint8_t handle, BT_HDR *p_pkt, uint32_t time_stamp, uint8_t m_pt); Loading Loading @@ -669,7 +669,7 @@ extern tBTA_AV_RCB * bta_av_get_rcb_by_shdl(uint8_t shdl); extern void bta_av_del_rc(tBTA_AV_RCB *p_rcb); /* ssm action functions */ extern void bta_av_do_disc_a2d (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data); extern void bta_av_do_disc_a2dp(tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data); extern void bta_av_cleanup (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data); extern void bta_av_free_sdb (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data); extern void bta_av_config_ind (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data); Loading
system/bta/av/bta_av_main.cc +27 −24 Original line number Diff line number Diff line Loading @@ -346,7 +346,7 @@ static tBTA_AV_SCB * bta_av_alloc_scb(tBTA_AV_CHNL chnl) p_ret->chnl = chnl; p_ret->hndl = (tBTA_AV_HNDL)((xx + 1) | chnl); p_ret->hdi = xx; p_ret->a2d_list = list_new(NULL); p_ret->a2dp_list = list_new(NULL); p_ret->avrc_ct_timer = alarm_new("bta_av.avrc_ct_timer"); bta_av_cb.p_scb[xx] = p_ret; break; Loading Loading @@ -550,14 +550,14 @@ static void bta_av_api_register(tBTA_AV_DATA *p_data) if(registr.chnl == BTA_AV_CHNL_AUDIO) { /* set up the audio stream control block */ p_scb->p_act_tbl = (const tBTA_AV_ACT *)bta_av_a2d_action; p_scb->p_cos = &bta_av_a2d_cos; p_scb->p_act_tbl = (const tBTA_AV_ACT *)bta_av_a2dp_action; p_scb->p_cos = &bta_av_a2dp_cos; p_scb->media_type= AVDT_MEDIA_TYPE_AUDIO; cs.cfg.psc_mask = AVDT_PSC_TRANS; cs.media_type = AVDT_MEDIA_TYPE_AUDIO; cs.mtu = p_bta_av_cfg->audio_mtu; cs.flush_to = L2CAP_DEFAULT_FLUSH_TO; tA2D_CODEC_SEP_INDEX codec_sep_index = A2D_CODEC_SEP_INDEX_SBC; tA2DP_CODEC_SEP_INDEX codec_sep_index = A2DP_CODEC_SEP_INDEX_SBC; #if (AVDT_REPORTING == TRUE) if(bta_av_cb.features & BTA_AV_FEAT_REPORT) Loading @@ -575,24 +575,24 @@ static void bta_av_api_register(tBTA_AV_DATA *p_data) if (profile_initialized == UUID_SERVCLASS_AUDIO_SOURCE) { cs.tsep = AVDT_TSEP_SRC; codec_sep_index = A2D_CODEC_SEP_INDEX_SBC; codec_sep_index = A2DP_CODEC_SEP_INDEX_SBC; } else if (profile_initialized == UUID_SERVCLASS_AUDIO_SINK) { cs.tsep = AVDT_TSEP_SNK; cs.p_sink_data_cback = bta_av_sink_data_cback; codec_sep_index = A2D_CODEC_SEP_INDEX_SBC_SINK; codec_sep_index = A2DP_CODEC_SEP_INDEX_SBC_SINK; } /* Initialize handles to zero */ for (int xx = 0; xx < A2D_CODEC_SEP_INDEX_MAX; xx++) for (int xx = 0; xx < A2DP_CODEC_SEP_INDEX_MAX; xx++) { p_scb->seps[xx].av_handle = 0; } /* keep the configuration in the stream control block */ memcpy(&p_scb->cfg, &cs.cfg, sizeof(tAVDT_CFG)); if ((*bta_av_a2d_cos.init)(codec_sep_index, &cs.cfg)) { if ((*bta_av_a2dp_cos.init)(codec_sep_index, &cs.cfg)) { if (AVDT_CreateStream(&p_scb->seps[codec_sep_index].av_handle, &cs) == AVDT_SUCCESS) { /* Save a copy of the codec */ Loading @@ -613,22 +613,24 @@ static void bta_av_api_register(tBTA_AV_DATA *p_data) if(!bta_av_cb.reg_audio) { bta_av_cb.sdp_a2d_handle = 0; bta_av_cb.sdp_a2d_snk_handle = 0; bta_av_cb.sdp_a2dp_handle = 0; bta_av_cb.sdp_a2dp_snk_handle = 0; if (profile_initialized == UUID_SERVCLASS_AUDIO_SOURCE) { /* create the SDP records on the 1st audio channel */ bta_av_cb.sdp_a2d_handle = SDP_CreateRecord(); A2D_AddRecord(UUID_SERVCLASS_AUDIO_SOURCE, p_service_name, NULL, A2D_SUPF_PLAYER, bta_av_cb.sdp_a2d_handle); bta_av_cb.sdp_a2dp_handle = SDP_CreateRecord(); A2DP_AddRecord(UUID_SERVCLASS_AUDIO_SOURCE, p_service_name, NULL, A2DP_SUPF_PLAYER, bta_av_cb.sdp_a2dp_handle); bta_sys_add_uuid(UUID_SERVCLASS_AUDIO_SOURCE); } else if (profile_initialized == UUID_SERVCLASS_AUDIO_SINK) { #if (BTA_AV_SINK_INCLUDED == TRUE) bta_av_cb.sdp_a2d_snk_handle = SDP_CreateRecord(); A2D_AddRecord(UUID_SERVCLASS_AUDIO_SINK, p_service_name, NULL, A2D_SUPF_PLAYER, bta_av_cb.sdp_a2d_snk_handle); bta_av_cb.sdp_a2dp_snk_handle = SDP_CreateRecord(); A2DP_AddRecord(UUID_SERVCLASS_AUDIO_SINK, p_service_name, NULL, A2DP_SUPF_PLAYER, bta_av_cb.sdp_a2dp_snk_handle); bta_sys_add_uuid(UUID_SERVCLASS_AUDIO_SINK); #endif } Loading Loading @@ -918,7 +920,7 @@ static void bta_av_sys_rs_cback (tBTA_SYS_CONN_STATUS status,uint8_t id, uint8_t p_scb->q_info.open.switch_res = BTA_AV_RS_FAIL; /* Continue av open process */ bta_av_do_disc_a2d (p_scb, (tBTA_AV_DATA *)&(p_scb->q_info.open)); bta_av_do_disc_a2dp(p_scb, (tBTA_AV_DATA *)&(p_scb->q_info.open)); } bta_av_cb.rs_idx = 0; Loading Loading @@ -1054,8 +1056,9 @@ bool bta_av_link_role_ok(tBTA_AV_SCB *p_scb, uint8_t bits) LOG_INFO(LOG_TAG, "%s hndl:x%x role:%d conn_audio:x%x bits:%d features:x%x", __func__, p_scb->hndl, role, bta_av_cb.conn_audio, bits, bta_av_cb.features); if (BTM_ROLE_MASTER != role && (A2D_BitsSet(bta_av_cb.conn_audio) > bits || (bta_av_cb.features & BTA_AV_FEAT_MASTER))) { if (BTM_ROLE_MASTER != role && (A2DP_BitsSet(bta_av_cb.conn_audio) > bits || (bta_av_cb.features & BTA_AV_FEAT_MASTER))) { if (bta_av_cb.features & BTA_AV_FEAT_MASTER) bta_sys_clear_policy(BTA_ID_AV, HCI_ENABLE_MASTER_SLAVE_SWITCH, p_scb->peer_addr); Loading Loading @@ -1122,7 +1125,7 @@ uint16_t bta_av_chk_mtu(tBTA_AV_SCB *p_scb, uint16_t mtu) ** ** Function bta_av_dup_audio_buf ** ** Description dup the audio data to the q_info.a2d of other audio channels ** Description dup the audio data to the q_info.a2dp of other audio channels ** ** Returns void ** Loading @@ -1147,13 +1150,13 @@ void bta_av_dup_audio_buf(tBTA_AV_SCB *p_scb, BT_HDR *p_buf) /* Enqueue the data */ BT_HDR *p_new = (BT_HDR *)osi_malloc(copy_size); memcpy(p_new, p_buf, copy_size); list_append(p_scbi->a2d_list, p_new); list_append(p_scbi->a2dp_list, p_new); if (list_length(p_scbi->a2d_list) > p_bta_av_cfg->audio_mqs) { if (list_length(p_scbi->a2dp_list) > p_bta_av_cfg->audio_mqs) { // Drop the oldest packet bta_av_co_audio_drop(p_scbi->hndl); BT_HDR *p_buf_drop = static_cast<BT_HDR *>(list_front(p_scbi->a2d_list)); list_remove(p_scbi->a2d_list, p_buf_drop); BT_HDR *p_buf_drop = static_cast<BT_HDR *>(list_front(p_scbi->a2dp_list)); list_remove(p_scbi->a2dp_list, p_buf_drop); osi_free(p_buf_drop); } } Loading