hfp_ag: send codec_event(CVSD) if no codec negotation happens. Remove hack in sco_util to fallback to CVSD without codec event

This commit is contained in:
Matthias Ringwald 2016-07-28 15:20:15 +02:00
parent ba3eebad97
commit d6ff09e13f
2 changed files with 3 additions and 12 deletions

View File

@ -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++;

View File

@ -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){