From 451c2ae3a3ba4cbb7718c7706a94646da0d4083d Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Thu, 16 Jun 2011 14:54:38 +0200 Subject: [PATCH] add apis to control upload ptime --- coreapi/linphonecall.c | 7 ++++++- coreapi/linphonecore.c | 26 ++++++++++++++++++++++++-- mediastreamer2 | 2 +- oRTP | 2 +- 4 files changed, 32 insertions(+), 5 deletions(-) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index 2aaad1444..36a41186e 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -793,6 +793,7 @@ static RtpProfile *make_profile(LinphoneCall *call, const SalMediaDescription *m bool_t first=TRUE; int remote_bw=0; LinphoneCore *lc=call->core; + int up_ptime=0; *used_pt=-1; for(elem=desc->payloads;elem!=NULL;elem=elem->next){ @@ -802,6 +803,7 @@ static RtpProfile *make_profile(LinphoneCall *call, const SalMediaDescription *m if (first) { if (desc->type==SalAudio){ linphone_core_update_allocated_audio_bandwidth_in_call(call,pt); + up_ptime=linphone_core_get_upload_ptime(lc); } *used_pt=payload_type_get_number(pt); first=FALSE; @@ -823,8 +825,11 @@ static RtpProfile *make_profile(LinphoneCall *call, const SalMediaDescription *m pt->normal_bitrate=-1; } if (desc->ptime>0){ + up_ptime=desc->ptime; + } + if (up_ptime>0){ char tmp[40]; - snprintf(tmp,sizeof(tmp),"ptime=%i",desc->ptime); + snprintf(tmp,sizeof(tmp),"ptime=%i",up_ptime); payload_type_append_send_fmtp(pt,tmp); } number=payload_type_get_number(pt); diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 7f0e8c727..2bbda0f24 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -861,16 +861,38 @@ int linphone_core_get_upload_bandwidth(const LinphoneCore *lc){ return lc->net_conf.upload_bw; } /** - * set audio packetization time linphone expect to received from peer + * Set audio packetization time linphone expects to receive from peer */ void linphone_core_set_download_ptime(LinphoneCore *lc, int ptime) { lc->net_conf.down_ptime=ptime; } -int linphone_core_get_download_ptime(LinphoneCore *lc) { +/** + * Get audio packetization time linphone expects to receive from peer + */ +int linphone_core_get_download_ptime(LinphoneCore *lc) { return lc->net_conf.down_ptime; } +/** + * Set audio packetization time linphone will send (in absence of requirement from peer) + * A value of 0 stands for the current codec default packetization time. + * +**/ +void linphone_core_set_upload_ptime(LinphoneCore *lc, int ptime){ + lp_config_set_int(lc->config,"rtp","up_ptime",ptime); +} + +/** + * Set audio packetization time linphone will send (in absence of requirement from peer) + * A value of 0 stands for the current codec default packetization time. + * +**/ +int linphone_core_get_upload_ptime(LinphoneCore *lc){ + return lp_config_get_int(lc->config,"rtp","up_ptime",0); +} + + /** * Returns liblinphone's version as a string. diff --git a/mediastreamer2 b/mediastreamer2 index fd74240c2..07d1b02eb 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit fd74240c297e33c7e96d14dc5f7ed5d3dbdb8dc0 +Subproject commit 07d1b02eb57b7fc5cc8e4821c6485df2f138906e diff --git a/oRTP b/oRTP index 6e9ac1d1f..3af8aa68f 160000 --- a/oRTP +++ b/oRTP @@ -1 +1 @@ -Subproject commit 6e9ac1d1f7c60f60bd67656c92ae801c61f41b27 +Subproject commit 3af8aa68f253d802b674cc1807115e4556c0fafa