From af52df8b8340e19fe2a0b18777f8c3c278260c73 Mon Sep 17 00:00:00 2001 From: weitianhua Date: Mon, 27 Jul 2020 21:57:44 +0800 Subject: [PATCH] Rewrite a2dp clean_up function --- .../host/bluedroid/btc/profile/std/a2dp/btc_av.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) 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 c62bca169f..1126a5f6d5 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 @@ -1081,11 +1081,13 @@ static void clean_up(int service_id) btc_av_cb.tle_av_open_on_rc = NULL; } #endif /* BTC_AV_SRC_INCLUDED */ + btc_dm_disable_service(BTA_A2DP_SOURCE_SERVICE_ID); } - btc_dm_disable_service(BTA_A2DP_SOURCE_SERVICE_ID); - if (service_id == BTA_A2DP_SINK_SERVICE_ID) { +#if BTC_AV_SINK_INCLUDED + btc_a2dp_sink_shutdown(); +#endif /* BTC_AV_SINK_INCLUDED */ btc_dm_disable_service(BTA_A2DP_SINK_SERVICE_ID); } @@ -1093,15 +1095,9 @@ static void clean_up(int service_id) btc_sm_shutdown(btc_av_cb.sm_handle); btc_av_cb.sm_handle = NULL; - if (service_id == BTA_A2DP_SINK_SERVICE_ID) { -#if BTC_AV_SINK_INCLUDED - btc_a2dp_sink_shutdown(); -#endif /* BTC_AV_SINK_INCLUDED */ - } - #if A2D_DYNAMIC_MEMORY == TRUE - osi_free(btc_av_cb_ptr); - btc_av_cb_ptr = NULL; + osi_free(btc_av_cb_ptr); + btc_av_cb_ptr = NULL; #endif }