From 9c42b6194e47c6f41447eeb3dc3f7dd4df99f468 Mon Sep 17 00:00:00 2001 From: Jiang Jiang Jian Date: Thu, 15 Mar 2018 15:28:11 +0800 Subject: [PATCH] Merge branch 'bugfix/btdm_a2dp_disc_rsn_error_when_as_master' into 'master' component/bt: Fix bug: a2dp disc_rsn error when as master See merge request idf/esp-idf!1995 (cherry picked from commit dc66940f82be8ef45710c1f0b8705c4f37cd0fa3) f1d3f689 component/bt: Fix bug: a2dp disc_rsn error when as master --- components/bt/bluedroid/bta/av/bta_av_aact.c | 3 +++ components/bt/bluedroid/bta/av/bta_av_main.c | 5 +++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/components/bt/bluedroid/bta/av/bta_av_aact.c b/components/bt/bluedroid/bta/av/bta_av_aact.c index c0f0b3398d..6498acd972 100644 --- a/components/bt/bluedroid/bta/av/bta_av_aact.c +++ b/components/bt/bluedroid/bta/av/bta_av_aact.c @@ -514,6 +514,9 @@ static void bta_av_proc_stream_evt(UINT8 handle, BD_ADDR bd_addr, UINT8 event, t p_msg->disc_rsn = p_data->hdr.err_param; break; */ + case AVDT_DISCONNECT_IND_EVT: + p_msg->hdr.offset = p_data->hdr.err_param; + break; default: break; } diff --git a/components/bt/bluedroid/bta/av/bta_av_main.c b/components/bt/bluedroid/bta/av/bta_av_main.c index 5d5f441a63..ba01e11e6c 100644 --- a/components/bt/bluedroid/bta/av/bta_av_main.c +++ b/components/bt/bluedroid/bta/av/bta_av_main.c @@ -1237,9 +1237,10 @@ BOOLEAN bta_av_hdl_event(BT_HDR *p_msg) bta_av_sm_execute(&bta_av_cb, p_msg->event, (tBTA_AV_DATA *) p_msg); } else { APPL_TRACE_VERBOSE("handle=0x%x\n", p_msg->layer_specific); + tBTA_AV_SCB *p_scb = bta_av_hndl_to_scb(p_msg->layer_specific); + p_scb->disc_rsn = p_msg->offset; /* stream state machine events */ - bta_av_ssm_execute( bta_av_hndl_to_scb(p_msg->layer_specific), - p_msg->event, (tBTA_AV_DATA *) p_msg); + bta_av_ssm_execute(p_scb, p_msg->event, (tBTA_AV_DATA *) p_msg); } return TRUE; }