From 59c9380b9186411c8882291d5a01cb91b5470f71 Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Thu, 11 Mar 2010 14:34:25 +0100 Subject: [PATCH] add support for download ptime --- coreapi/exevents.c | 4 ++++ coreapi/linphonecore.c | 16 ++++++++++++++++ coreapi/linphonecore.h | 13 ++++++++++++- coreapi/sdphandler.c | 5 +++++ 4 files changed, 37 insertions(+), 1 deletion(-) diff --git a/coreapi/exevents.c b/coreapi/exevents.c index 36ed2b6d7..4dcee01a6 100644 --- a/coreapi/exevents.c +++ b/coreapi/exevents.c @@ -481,6 +481,10 @@ int linphone_set_audio_offer(sdp_context_t *ctx) payload.a_rtpmap="telephone-event/8000"; payload.a_fmtp="0-11"; if (lc->dw_audio_bw>0) payload.b_as_bandwidth=lc->dw_audio_bw; + if (lc->down_ptime>0) { + payload.a_ptime=lc->down_ptime; + ms_message("ptime [%i]",payload.a_ptime); + } sdp_context_add_audio_payload(ctx,&payload); return 0; } diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 5f94e634e..284a6e56d 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -487,6 +487,9 @@ net_config_read (LinphoneCore *lc) lc->net_conf.nat_sdp_only=tmp; tmp=lp_config_get_int(lc->config,"net","mtu",0); linphone_core_set_mtu(lc,tmp); + tmp=lp_config_get_int(lc->config,"net","download_ptime",0); + linphone_core_set_download_ptime(lc,tmp); + } static void build_sound_devices_table(LinphoneCore *lc){ @@ -854,6 +857,18 @@ int linphone_core_get_download_bandwidth(const LinphoneCore *lc){ 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 + */ +void linphone_core_set_download_ptime(LinphoneCore *lc, int ptime); + +void linphone_core_set_download_ptime(LinphoneCore *lc, int ptime) { + lc->down_ptime=ptime; +} +int linphone_core_get_download_ptime(LinphoneCore *lc) { + return lc->down_ptime; +} + /** * Returns liblinphone's version as a string. @@ -952,6 +967,7 @@ static void linphone_core_init (LinphoneCore * lc, const LinphoneCoreVTable *vta lc->vtable.display_status(lc,_("Ready")); gstate_new_state(lc, GSTATE_POWER_ON, NULL); lc->auto_net_state_mon=TRUE; + lc->ready=TRUE; } diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index 0796a6d05..4561250a0 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -661,6 +661,7 @@ typedef struct _LinphoneCore * In case of false, network state must be communicate to linphone core with method linphone_core_ */ bool_t auto_net_state_mon; + int down_ptime; } LinphoneCore; @@ -712,7 +713,17 @@ void linphone_core_set_upload_bandwidth(LinphoneCore *lc, int bw); int linphone_core_get_download_bandwidth(const LinphoneCore *lc); int linphone_core_get_upload_bandwidth(const LinphoneCore *lc); - +/** + * set audio packetization time linphone expect to received from peer + * @ingroup media_parameters + * + */ +void linphone_core_set_download_ptime(LinphoneCore *lc, int ptime); +/** + * get audio packetization time linphone expect to received from peer, 0 means unspecified + * @ingroup media_parameters + */ +int linphone_core_get_download_ptime(LinphoneCore *lc); #ifdef VINCENT_MAURY_RSVP /* QoS functions */ diff --git a/coreapi/sdphandler.c b/coreapi/sdphandler.c index 890217289..bf622a92e 100644 --- a/coreapi/sdphandler.c +++ b/coreapi/sdphandler.c @@ -238,6 +238,11 @@ sdp_context_add_payload (sdp_context_t * ctx, sdp_payload_t * payload, char *med attr_field); } } + if (payload->a_ptime !=0) { + attr_field = sstrdup_sprintf ("%i", payload->a_ptime); + sdp_message_a_attribute_add(offer, payload->line,osip_strdup ("ptime"),attr_field); + ms_message("adding ptime [%s]",attr_field); + } } void