return;
}
- /* disallow role switch during streaming, only if we are the central role
- * i.e. allow role switch, if we are peripheral.
- * It would not hurt us, if the peer device wants us to be central */
- tHCI_ROLE cur_role;
- if ((BTM_GetRole(p_scb->PeerAddress(), &cur_role) == BTM_SUCCESS) &&
- (cur_role == HCI_ROLE_CENTRAL)) {
- BTM_block_role_switch_for(p_scb->PeerAddress());
- }
- BTM_block_sniff_mode_for(p_scb->PeerAddress());
-
if (p_scb->started) {
p_scb->role |= BTA_AV_ROLE_START_INT;
if (p_scb->wait != 0) {
p_scb->role |= BTA_AV_ROLE_START_INT;
bta_sys_busy(BTA_ID_AV, bta_av_cb.audio_open_cnt, p_scb->PeerAddress());
+ /* disallow role switch during streaming, only if we are the central role
+ * i.e. allow role switch, if we are peripheral.
+ * It would not hurt us, if the peer device wants us to be central
+ * disable sniff mode unconditionally during streaming */
+ tHCI_ROLE cur_role;
+ if ((BTM_GetRole(p_scb->PeerAddress(), &cur_role) == BTM_SUCCESS) &&
+ (cur_role == HCI_ROLE_CENTRAL)) {
+ BTM_block_role_switch_and_sniff_mode_for(p_scb->PeerAddress());
+ } else {
+ BTM_block_sniff_mode_for(p_scb->PeerAddress());
+ }
+
uint16_t result = AVDT_StartReq(&p_scb->avdt_handle, 1);
if (result != AVDT_SUCCESS) {
LOG_ERROR("%s: AVDT_StartReq failed for peer %s result:%d", __func__,
bta_av_cb.audio_open_cnt, p_data, start);
bta_sys_idle(BTA_ID_AV, bta_av_cb.audio_open_cnt, p_scb->PeerAddress());
- BTM_unblock_role_switch_for(p_scb->PeerAddress());
- BTM_unblock_sniff_mode_for(p_scb->PeerAddress());
+ BTM_unblock_role_switch_and_sniff_mode_for(p_scb->PeerAddress());
if (p_scb->co_started) {
uint16_t handle = get_btm_client_interface().lifecycle.BTM_GetHCIConnHandle(
/* If souce is the central role, disable role switch during streaming.
* Otherwise allow role switch, if source is peripheral.
* Because it would not hurt source, if the peer device wants source to be
- * central */
+ * central.
+ * disable sniff mode unconditionally during streaming */
if ((BTM_GetRole(p_scb->PeerAddress(), &cur_role) == BTM_SUCCESS) &&
(cur_role == HCI_ROLE_CENTRAL)) {
- BTM_block_role_switch_for(p_scb->PeerAddress());
+ BTM_block_role_switch_and_sniff_mode_for(p_scb->PeerAddress());
+ } else {
+ BTM_block_sniff_mode_for(p_scb->PeerAddress());
}
}
notify_start_failed(p_scb);
}
- BTM_unblock_role_switch_for(p_scb->PeerAddress());
- BTM_unblock_sniff_mode_for(p_scb->PeerAddress());
+ BTM_unblock_role_switch_and_sniff_mode_for(p_scb->PeerAddress());
p_scb->sco_suspend = false;
}
__func__, p_scb->PeerAddress().ToString().c_str(), p_scb->hndl,
p_scb->open_status, p_scb->chnl, p_scb->co_started);
- BTM_unblock_role_switch_for(p_scb->PeerAddress());
- BTM_unblock_sniff_mode_for(p_scb->PeerAddress());
+ BTM_unblock_role_switch_and_sniff_mode_for(p_scb->PeerAddress());
if (bta_av_cb.audio_open_cnt <= 1) {
BTM_default_unblock_role_switch();
}
}
bta_sys_idle(BTA_ID_AV, bta_av_cb.audio_open_cnt, p_scb->PeerAddress());
- BTM_unblock_role_switch_for(p_scb->PeerAddress());
- BTM_unblock_sniff_mode_for(p_scb->PeerAddress());
+ BTM_unblock_role_switch_and_sniff_mode_for(p_scb->PeerAddress());
/* in case that we received suspend_ind, we may need to call co_stop here */
if (p_scb->co_started) {