diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 03dd18c7f..bdf64f557 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -1035,15 +1035,6 @@ static MSList *codec_append_if_new(MSList *l, PayloadType *pt){ return l; } -#if defined(ANDROID) -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 - static void codecs_config_read(LinphoneCore *lc) { int i; @@ -1059,16 +1050,6 @@ static void codecs_config_read(LinphoneCore *lc) } audio_codecs=add_missing_codecs(lc,SalAudio,audio_codecs); -#if defined(ANDROID) - /* 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_not_16k_payload, NULL); - ms_message("Disable AAC-ELD (needs hardware AEC)"); - } -#endif - for (i=0;get_codec(lc,"video_codec",i,&pt);i++){ if (pt){ if (!ms_filter_codec_supported(pt->mime_type)){ diff --git a/coreapi/misc.c b/coreapi/misc.c index c89111333..efca3c9f9 100644 --- a/coreapi/misc.c +++ b/coreapi/misc.c @@ -250,7 +250,18 @@ bool_t linphone_core_is_payload_type_usable_for_bandwidth(LinphoneCore *lc, cons /* return TRUE if codec can be used with bandwidth, FALSE else*/ bool_t linphone_core_check_payload_type_usability(LinphoneCore *lc, const PayloadType *pt){ - return linphone_core_is_payload_type_usable_for_bandwidth(lc, pt, linphone_core_get_payload_type_bitrate(lc,pt)); + bool_t ret=linphone_core_is_payload_type_usable_for_bandwidth(lc, pt, linphone_core_get_payload_type_bitrate(lc,pt)); + if (lc->sound_conf.capt_sndcard + && !(ms_snd_card_get_capabilities(lc->sound_conf.capt_sndcard) & MS_SND_CARD_CAP_BUILTIN_ECHO_CANCELLER) + && linphone_core_echo_cancellation_enabled(lc) + && (pt->clock_rate!=16000 && pt->clock_rate!=8000) + && strcasecmp(pt->mime_type,"opus")!=0 + && ms_filter_lookup_by_name("MSWebRTCAEC")!=NULL){ + ms_warning("Payload type %s/%i cannot be used because software echo cancellation is required but is unable to operate at this rate.", + pt->mime_type,pt->clock_rate); + ret=FALSE; + } + return ret; } bool_t lp_spawn_command_line_sync(const char *command, char **result,int *command_ret){