From d6ff09e13f87fc2f395836d012ee39d46f462c9e Mon Sep 17 00:00:00 2001 From: Matthias Ringwald Date: Thu, 28 Jul 2016 15:20:15 +0200 Subject: [PATCH] hfp_ag: send codec_event(CVSD) if no codec negotation happens. Remove hack in sco_util to fallback to CVSD without codec event --- example/sco_demo_util.c | 11 ----------- src/classic/hfp_ag.c | 4 +++- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/example/sco_demo_util.c b/example/sco_demo_util.c index 067af107e..97c230ec3 100644 --- a/example/sco_demo_util.c +++ b/example/sco_demo_util.c @@ -374,19 +374,10 @@ static void sco_report(void){ printf("SCO: sent %u, received %u\n", count_sent, count_received); } -static void sco_assert_codec_set(void){ - // if SCO is open but we didn't hear about the codec yet, we fall back to CVSD - if (!negotiated_codec){ - sco_demo_set_codec(HFP_CODEC_CVSD); - } -} - void sco_demo_send(hci_con_handle_t sco_handle){ if (!sco_handle) return; - sco_assert_codec_set(); - const int sco_packet_length = 24 + 3; // hci_get_sco_packet_length(); const int sco_payload_length = sco_packet_length - 3; @@ -445,8 +436,6 @@ void sco_demo_send(hci_con_handle_t sco_handle){ */ void sco_demo_receive(uint8_t * packet, uint16_t size){ - sco_assert_codec_set(); - dump_data = 1; count_received++; diff --git a/src/classic/hfp_ag.c b/src/classic/hfp_ag.c index 92d1ec70c..14c8a66a2 100644 --- a/src/classic/hfp_ag.c +++ b/src/classic/hfp_ag.c @@ -2130,8 +2130,10 @@ static void hfp_ag_setup_audio_connection(hfp_connection_t * hfp_connection){ hfp_connection->establish_audio_connection = 1; if (!has_codec_negotiation_feature(hfp_connection)){ - log_info("hfp_ag_establish_audio_connection - no codec negotiation feature, using defaults"); + log_info("hfp_ag_establish_audio_connection - no codec negotiation feature, using CVSD"); + hfp_connection->negotiated_codec = HFP_CODEC_CVSD; hfp_connection->codecs_state = HFP_CODECS_EXCHANGED; + hfp_emit_codec_event(hfp_callback, 0, hfp_connection->negotiated_codec); } switch (hfp_connection->codecs_state){