From 891010b78af4fe2484c7d1787e2659f7dee14e45 Mon Sep 17 00:00:00 2001 From: Pierre-Eric Pelloux-Prayer Date: Thu, 23 Oct 2014 20:56:21 +0200 Subject: [PATCH] android/aac: aac needs either hardware AEC or 16kHz sample rate --- coreapi/linphonecore.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 22e53b7a0..cac592107 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -1031,8 +1031,10 @@ static MSList *codec_append_if_new(MSList *l, PayloadType *pt){ } #if defined(ANDROID) -static int is_aac_eld_payload(const void* a, const void* b) { - PayloadType *pt = (PayloadType*)a; +static int is_aac_eld_not_16k_payload(const void* _pt, const void* unused) { + PayloadType *pt = (PayloadType*)_pt; + if (pt->clock_rate == 16000) + return 1; return strncmp(pt->mime_type, "mpeg4-generic", strlen("mpeg4-generic")); } #endif @@ -1053,11 +1055,11 @@ static void codecs_config_read(LinphoneCore *lc) audio_codecs=add_missing_codecs(lc,SalAudio,audio_codecs); #if defined(ANDROID) - /* AAC-ELD requires hardware AEC */ + /* AAC-ELD requires hardware AEC or 16kHz sample rate */ if (lc->sound_conf.capt_sndcard && !(ms_snd_card_get_capabilities(lc->sound_conf.capt_sndcard) & MS_SND_CARD_CAP_BUILTIN_ECHO_CANCELLER)) { /* Remove AAC-ELD */ - audio_codecs = ms_list_remove_custom(audio_codecs, is_aac_eld_payload, NULL); + audio_codecs = ms_list_remove_custom(audio_codecs, is_aac_eld_not_16k_payload, NULL); ms_message("Disable AAC-ELD (needs hardware AEC)"); } #endif