add support for download ptime

This commit is contained in:
Jehan Monnier 2010-03-11 14:34:25 +01:00
parent 4c4204ef96
commit 59c9380b91
4 changed files with 37 additions and 1 deletions

View file

@ -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;
}

View file

@ -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;
}

View file

@ -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 */

View file

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