Ejemplo n.º 1
0
static void set_codec_enable(LinphoneCore* lc,const char* type,int rate,bool_t enable) {
	MSList* codecs=ms_list_copy(linphone_core_get_audio_codecs(lc));
	MSList* codecs_it;
	PayloadType* pt;
	for (codecs_it=codecs;codecs_it!=NULL;codecs_it=codecs_it->next) {
		linphone_core_enable_payload_type(lc,(PayloadType*)codecs_it->data,0);
	}
	if((pt = linphone_core_find_payload_type(lc,type,rate,1))) {
		linphone_core_enable_payload_type(lc,pt, enable);
	}
	ms_list_free(codecs);
}
Ejemplo n.º 2
0
void linphone_core_update_allocated_audio_bandwidth(LinphoneCore *lc){
	const MSList *elem;
	PayloadType *max=NULL;
	for(elem=linphone_core_get_audio_codecs(lc);elem!=NULL;elem=elem->next){
		PayloadType *pt=(PayloadType*)elem->data;
		if (payload_type_enabled(pt)){
			int pt_bitrate=get_codec_bitrate(lc,pt);
			if (max==NULL) max=pt;
			else if (max->normal_bitrate<pt_bitrate){
				max=pt;
			}
		}
	}
	if (max) {
		lc->audio_bw=(int)(get_audio_payload_bandwidth(lc,max)/1000.0);
	}
}
Ejemplo n.º 3
0
/*check basic things about codecs at startup: order and enablement*/
static void start_with_no_config(void){
	LinphoneCoreVTable vtable={0};
	LinphoneCore *lc=linphone_core_new(&vtable, NULL, NULL, NULL);
	const MSList *codecs=linphone_core_get_audio_codecs(lc);
	int opus_codec_pos;
	int speex_codec_pos=get_codec_position(codecs, "speex", 8000);
	int speex16_codec_pos=get_codec_position(codecs, "speex", 16000);
	PayloadType *pt;
	opus_codec_pos=get_codec_position(codecs, "opus", 48000);
	if (opus_codec_pos!=-1) CU_ASSERT_TRUE(opus_codec_pos==0);
	CU_ASSERT_TRUE(speex16_codec_pos<speex_codec_pos);
	
	pt=linphone_core_find_payload_type(lc, "speex", 16000, 1);
	CU_ASSERT_PTR_NOT_NULL(pt);
	if (pt) {
		CU_ASSERT_TRUE(linphone_core_payload_type_enabled(lc, pt)==TRUE);
	}
	linphone_core_destroy(lc);
}