diff --git a/CHANGELOG.md b/CHANGELOG.md index 856ac55da..2bfc4b739 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,7 +22,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Scan Parameter Service Client: emit disconnected event on HCI disconnect and free connection struct - PBAP Client: fix PBAP_SUBEVENT_OPERATION_COMPLETED with OBEX_DISCONNECTED for pbap_disconnect - HFP HF: send HF Indicator update only if enabled by AG - +- HFP AG: always initiate codec connection setup before establishing audio + ### Changed - GAP: return command disallowed if disconnect already requested - GAP: improve handling of incorrectly resolved addresses in HCI_SUBEVENT_LE_CONNECTION_COMPLETE diff --git a/src/classic/hfp_ag.c b/src/classic/hfp_ag.c index d51260701..8a2af2052 100644 --- a/src/classic/hfp_ag.c +++ b/src/classic/hfp_ag.c @@ -2760,22 +2760,8 @@ static uint8_t hfp_ag_setup_audio_connection(hfp_connection_t * hfp_connection){ return ERROR_CODE_SUCCESS; } - uint8_t i; - bool codec_was_in_use = false; - bool better_codec_can_be_used = false; - - for (i = 0; iremote_codecs_nr; i++){ - if (hfp_connection->negotiated_codec == hfp_connection->remote_codecs[i]){ - codec_was_in_use = true; - } else if (hfp_connection->negotiated_codec < hfp_connection->remote_codecs[i]){ - better_codec_can_be_used = true; - } - } - - if (!codec_was_in_use || better_codec_can_be_used){ - hfp_connection->ag_send_common_codec = true; - hfp_connection->codecs_state = HFP_CODECS_IDLE; - } + hfp_connection->ag_send_common_codec = true; + hfp_connection->codecs_state = HFP_CODECS_IDLE; return ERROR_CODE_SUCCESS; }