forcely do not use some codecs under the following conditions:

rate!=8000 and rate!=16000
no hardware AEC
AEC required (thus software)
webRTC AEC is used
not opus (because opus can accept 16khz in input)
This commit is contained in:
Simon Morlat 2014-10-27 15:51:15 +01:00
parent 2409af7637
commit cf3b09e35b
2 changed files with 12 additions and 20 deletions

View file

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

View file

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