diff --git a/components/bt/host/bluedroid/btc/profile/std/a2dp/btc_a2dp_control.c b/components/bt/host/bluedroid/btc/profile/std/a2dp/btc_a2dp_control.c index 732ab503f8..3dd1134895 100644 --- a/components/bt/host/bluedroid/btc/profile/std/a2dp/btc_a2dp_control.c +++ b/components/bt/host/bluedroid/btc/profile/std/a2dp/btc_a2dp_control.c @@ -146,10 +146,8 @@ void btc_a2dp_control_media_ctrl(esp_a2d_media_ctrl_t ctrl) break; case ESP_A2D_MEDIA_CTRL_START: if (btc_av_stream_ready() == TRUE ) { - /* post start event and wait for audio path to open */ + /* post start event */ btc_dispatch_sm_event(BTC_AV_START_STREAM_REQ_EVT, NULL, 0); - - btc_a2dp_dispatch_datapath_evt(BTC_AV_DATAPATH_OPEN_EVT); #if (BTC_AV_SINK_INCLUDED == TRUE) if (btc_av_get_peer_sep() == AVDT_TSEP_SRC && btc_av_get_service_id() == BTA_A2DP_SINK_SERVICE_ID) { btc_a2dp_control_command_ack(ESP_A2D_MEDIA_CTRL_ACK_SUCCESS); diff --git a/components/bt/host/bluedroid/btc/profile/std/a2dp/btc_av.c b/components/bt/host/bluedroid/btc/profile/std/a2dp/btc_av.c index a614f72eaf..1ff744ce67 100644 --- a/components/bt/host/bluedroid/btc/profile/std/a2dp/btc_av.c +++ b/components/bt/host/bluedroid/btc/profile/std/a2dp/btc_av.c @@ -451,7 +451,7 @@ static BOOLEAN btc_av_state_opening_handler(btc_sm_event_t event, void *p_data) av_state = BTC_AV_STATE_OPENED; } else { BTC_TRACE_WARNING("BTA_AV_OPEN_EVT::FAILED status: %d\n", p_bta_data->open.status); - + conn_stat = ESP_A2D_CONNECTION_STATE_DISCONNECTED; av_state = BTC_AV_STATE_IDLE; } @@ -681,6 +681,9 @@ static BOOLEAN btc_av_state_opened_handler(btc_sm_event_t event, void *p_data) /* pending start flag will be cleared when exit current state */ } #endif /* BTC_AV_SRC_INCLUDED */ + /* wait for audio path to open */ + btc_a2dp_control_datapath_ctrl(BTC_AV_DATAPATH_OPEN_EVT); + btc_sm_change_state(btc_av_cb.sm_handle, BTC_AV_STATE_STARTED); } break; @@ -1470,7 +1473,7 @@ void btc_a2dp_call_handler(btc_msg_t *msg) } case BTC_AV_SINK_API_DISCONNECT_EVT: { CHECK_BTAV_INIT(); - btc_av_disconn_req_t disconn_req; + btc_av_disconn_req_t disconn_req; memcpy(&disconn_req.target_bda, &arg->disconn, sizeof(bt_bdaddr_t)); btc_sm_dispatch(btc_av_cb.sm_handle, BTC_AV_DISCONNECT_REQ_EVT, &disconn_req); break;