Commit 4ec4836f authored by Simon Morlat's avatar Simon Morlat

do not write to av_profile

parent d64c1cc2
......@@ -244,7 +244,7 @@ void linphone_call_make_local_media_description(LinphoneCore *lc, LinphoneCall *
else
md->streams[0].ptime=linphone_core_get_download_ptime(lc);
l=make_codec_list(lc,lc->codecs_conf.audio_codecs,call->params.audio_bw,&md->streams[0].max_rate);
pt=payload_type_clone(rtp_profile_get_payload_from_mime(&av_profile,"telephone-event"));
pt=payload_type_clone(rtp_profile_get_payload_from_mime(lc->default_profile,"telephone-event"));
l=ms_list_append(l,pt);
md->streams[0].payloads=l;
......
......@@ -707,11 +707,12 @@ static PayloadType * find_payload(RtpProfile *prof, const char *mime_type, int c
return candidate;
}
static bool_t get_codec(LpConfig *config, const char* type, int index, PayloadType **ret){
static bool_t get_codec(LinphoneCore *lc, const char* type, int index, PayloadType **ret){
char codeckey[50];
const char *mime,*fmtp;
int rate,channels,enabled;
PayloadType *pt;
LpConfig *config=lc->config;
*ret=NULL;
snprintf(codeckey,50,"%s_%i",type,index);
......@@ -722,7 +723,7 @@ static bool_t get_codec(LpConfig *config, const char* type, int index, PayloadTy
fmtp=lp_config_get_string(config,codeckey,"recv_fmtp",NULL);
channels=lp_config_get_int(config,codeckey,"channels",0);
enabled=lp_config_get_int(config,codeckey,"enabled",1);
pt=find_payload(&av_profile,mime,rate,channels,fmtp);
pt=find_payload(lc->default_profile,mime,rate,channels,fmtp);
if (pt && enabled ) pt->flags|=PAYLOAD_TYPE_ENABLED;
//ms_message("Found codec %s/%i",pt->mime_type,pt->clock_rate);
if (pt==NULL) ms_warning("Ignoring codec config %s/%i with fmtp=%s because unsupported",
......@@ -768,10 +769,10 @@ static int codec_compare(const PayloadType *a, const PayloadType *b){
return 0;
}
static MSList *add_missing_codecs(SalStreamType mtype, MSList *l){
static MSList *add_missing_codecs(LinphoneCore *lc, SalStreamType mtype, MSList *l){
int i;
for(i=0;i<RTP_PROFILE_MAX_PAYLOADS;++i){
PayloadType *pt=rtp_profile_get_payload(&av_profile,i);
PayloadType *pt=rtp_profile_get_payload(lc->default_profile,i);
if (pt){
if (mtype==SalVideo && pt->type!=PAYLOAD_VIDEO)
pt=NULL;
......@@ -812,22 +813,22 @@ static void codecs_config_read(LinphoneCore *lc)
PayloadType *pt;
MSList *audio_codecs=NULL;
MSList *video_codecs=NULL;
for (i=0;get_codec(lc->config,"audio_codec",i,&pt);i++){
for (i=0;get_codec(lc,"audio_codec",i,&pt);i++){
if (pt){
if (!ms_filter_codec_supported(pt->mime_type)){
ms_warning("Codec %s is not supported by mediastreamer2, removed.",pt->mime_type);
}else audio_codecs=codec_append_if_new(audio_codecs,pt);
}
}
audio_codecs=add_missing_codecs(SalAudio,audio_codecs);
for (i=0;get_codec(lc->config,"video_codec",i,&pt);i++){
audio_codecs=add_missing_codecs(lc,SalAudio,audio_codecs);
for (i=0;get_codec(lc,"video_codec",i,&pt);i++){
if (pt){
if (!ms_filter_codec_supported(pt->mime_type)){
ms_warning("Codec %s is not supported by mediastreamer2, removed.",pt->mime_type);
}else video_codecs=codec_append_if_new(video_codecs,(void *)pt);
}
}
video_codecs=add_missing_codecs(SalVideo,video_codecs);
video_codecs=add_missing_codecs(lc,SalVideo,video_codecs);
linphone_core_set_audio_codecs(lc,audio_codecs);
linphone_core_set_video_codecs(lc,video_codecs);
linphone_core_update_allocated_audio_bandwidth(lc);
......@@ -1074,7 +1075,7 @@ static void linphone_core_assign_payload_type(LinphoneCore *lc, PayloadType *con
ms_message("assigning %s/%i payload type number %i",pt->mime_type,pt->clock_rate,number);
payload_type_set_number(pt,number);
if (recv_fmtp!=NULL) payload_type_set_recv_fmtp(pt,recv_fmtp);
rtp_profile_set_payload(&av_profile,number,pt);
rtp_profile_set_payload(lc->default_profile,number,pt);
lc->payload_types=ms_list_append(lc->payload_types,pt);
}
......@@ -1092,6 +1093,8 @@ static void linphone_core_handle_static_payloads(LinphoneCore *lc){
}
static void linphone_core_free_payload_types(LinphoneCore *lc){
rtp_profile_clear_all(lc->default_profile);
rtp_profile_destroy(lc->default_profile);
ms_list_for_each(lc->payload_types,(void (*)(void*))payload_type_destroy);
ms_list_free(lc->payload_types);
lc->payload_types=NULL;
......@@ -1125,6 +1128,7 @@ static void linphone_core_init (LinphoneCore * lc, const LinphoneCoreVTable *vta
linphone_core_set_state(lc,LinphoneGlobalStartup,"Starting up");
ortp_init();
lc->dyn_pt=96;
lc->default_profile=rtp_profile_new("default profile");
linphone_core_assign_payload_type(lc,&payload_type_pcmu8000,0,NULL);
linphone_core_assign_payload_type(lc,&payload_type_gsm,3,NULL);
linphone_core_assign_payload_type(lc,&payload_type_pcma8000,8,NULL);
......
......@@ -502,6 +502,7 @@ struct _LinphoneCore
Sal *sal;
LinphoneGlobalState state;
struct _LpConfig *config;
RtpProfile *default_profile;
net_config_t net_conf;
sip_config_t sip_conf;
rtp_config_t rtp_conf;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment