From cc241d02d5700a8ecc31f02603a1877a7ed8e39d Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Mon, 27 Aug 2012 12:52:51 +0200 Subject: [PATCH 1/2] Update ms2. --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index b184aec8e..d622cd514 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit b184aec8e85e094df2b9c18e0ba4bf19aa873ec9 +Subproject commit d622cd51499ad0745e519eb129ea133fa8fd168b From 199108c92435cc0f7daf3dd8f6bdc6d9830b3af0 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Mon, 27 Aug 2012 12:51:41 +0200 Subject: [PATCH 2/2] Add configuration of adaptive jitter compensation enabling. --- coreapi/linphonecall.c | 7 +++--- coreapi/linphonecore.c | 51 ++++++++++++++++++++++++++++++++++++++++-- coreapi/linphonecore.h | 12 ++++++++++ coreapi/private.h | 2 ++ 4 files changed, 67 insertions(+), 5 deletions(-) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index 4ffb699b2..f1823165f 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -1203,7 +1203,6 @@ static int find_crypto_index_from_tag(const SalSrtpCryptoAlgo crypto[],unsigned } static void linphone_call_start_audio_stream(LinphoneCall *call, const char *cname, bool_t muted, bool_t send_ringbacktone, bool_t use_arc){ LinphoneCore *lc=call->core; - int jitt_comp=lc->rtp_conf.audio_jitt_comp; int used_pt=-1; /* look for savp stream first */ const SalStreamDescription *stream=sal_media_description_find_stream(call->resultdesc, @@ -1263,6 +1262,7 @@ static void linphone_call_start_audio_stream(LinphoneCall *call, const char *cna if (playcard && stream->max_rate>0) ms_snd_card_set_preferred_sample_rate(playcard, stream->max_rate); if (captcard && stream->max_rate>0) ms_snd_card_set_preferred_sample_rate(captcard, stream->max_rate); audio_stream_enable_adaptive_bitrate_control(call->audiostream,use_arc); + audio_stream_enable_adaptive_jittcomp(call->audiostream, linphone_core_audio_adaptive_jittcomp_enabled(lc)); audio_stream_start_full( call->audiostream, call->audio_profile, @@ -1271,7 +1271,7 @@ static void linphone_call_start_audio_stream(LinphoneCall *call, const char *cna stream->rtcp_addr[0]!='\0' ? stream->rtcp_addr : call->resultdesc->addr, linphone_core_rtcp_enabled(lc) ? (stream->rtcp_port) : 0, used_pt, - jitt_comp, + linphone_core_get_audio_jittcomp(lc), playfile, recfile, playcard, @@ -1351,6 +1351,7 @@ static void linphone_call_start_video_stream(LinphoneCall *call, const char *cna video_stream_enable_adaptive_bitrate_control(call->videostream, linphone_core_adaptive_rate_control_enabled(lc)); + video_stream_enable_adaptive_jittcomp(call->videostream, linphone_core_video_adaptive_jittcomp_enabled(lc)); video_stream_set_sent_video_size(call->videostream,linphone_core_get_preferred_video_size(lc)); video_stream_enable_self_view(call->videostream,lc->video_conf.selfview); if (lc->video_window_id!=0) @@ -1387,7 +1388,7 @@ static void linphone_call_start_video_stream(LinphoneCall *call, const char *cna video_stream_start(call->videostream, call->video_profile, rtp_addr, vstream->rtp_port, rtcp_addr, linphone_core_rtcp_enabled(lc) ? (vstream->rtcp_port) : 0, - used_pt, lc->rtp_conf.audio_jitt_comp, cam); + used_pt, linphone_core_get_video_jittcomp(lc), cam); video_stream_set_rtcp_information(call->videostream, cname,LINPHONE_RTCP_SDES_TOOL); } diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 46c8b11c0..3d05816ca 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -623,6 +623,7 @@ static void rtp_config_read(LinphoneCore *lc) int jitt_comp; int nortp_timeout; bool_t rtp_no_xmit_on_audio_mute; + bool_t adaptive_jitt_comp_enabled; port=lp_config_get_int(lc->config,"rtp","audio_rtp_port",7078); linphone_core_set_audio_port(lc,port); @@ -635,11 +636,15 @@ static void rtp_config_read(LinphoneCore *lc) linphone_core_set_audio_jittcomp(lc,jitt_comp); jitt_comp=lp_config_get_int(lc->config,"rtp","video_jitt_comp",60); if (jitt_comp==0) jitt_comp=60; - lc->rtp_conf.video_jitt_comp=jitt_comp; + linphone_core_set_video_jittcomp(lc,jitt_comp); nortp_timeout=lp_config_get_int(lc->config,"rtp","nortp_timeout",30); linphone_core_set_nortp_timeout(lc,nortp_timeout); rtp_no_xmit_on_audio_mute=lp_config_get_int(lc->config,"rtp","rtp_no_xmit_on_audio_mute",FALSE); linphone_core_set_rtp_no_xmit_on_audio_mute(lc,rtp_no_xmit_on_audio_mute); + adaptive_jitt_comp_enabled = lp_config_get_int(lc->config, "rtp", "audio_adaptive_jitt_comp_enabled", TRUE); + linphone_core_enable_audio_adaptive_jittcomp(lc, adaptive_jitt_comp_enabled); + adaptive_jitt_comp_enabled = lp_config_get_int(lc->config, "rtp", "video_adaptive_jitt_comp_enabled", TRUE); + linphone_core_enable_video_adaptive_jittcomp(lc, adaptive_jitt_comp_enabled); } static PayloadType * find_payload(RtpProfile *prof, const char *mime_type, int clock_rate, const char *recv_fmtp){ @@ -1376,8 +1381,18 @@ const MSList * linphone_core_get_friend_list(const LinphoneCore *lc) return lc->friends; } +void linphone_core_enable_audio_adaptive_jittcomp(LinphoneCore* lc, bool_t val) +{ + lc->rtp_conf.audio_adaptive_jitt_comp_enabled = val; +} + +bool_t linphone_core_audio_adaptive_jittcomp_enabled(LinphoneCore* lc) +{ + return lc->rtp_conf.audio_adaptive_jitt_comp_enabled; +} + /** - * Returns the nominal jitter buffer size in milliseconds. + * Returns the nominal audio jitter buffer size in milliseconds. * * @ingroup media_parameters **/ @@ -1386,6 +1401,26 @@ int linphone_core_get_audio_jittcomp(LinphoneCore *lc) return lc->rtp_conf.audio_jitt_comp; } +void linphone_core_enable_video_adaptive_jittcomp(LinphoneCore* lc, bool_t val) +{ + lc->rtp_conf.video_adaptive_jitt_comp_enabled = val; +} + +bool_t linphone_core_video_adaptive_jittcomp_enabled(LinphoneCore* lc) +{ + return lc->rtp_conf.video_adaptive_jitt_comp_enabled; +} + +/** + * Returns the nominal video jitter buffer size in milliseconds. + * + * @ingroup media_parameters +**/ +int linphone_core_get_video_jittcomp(LinphoneCore *lc) +{ + return lc->rtp_conf.video_jitt_comp; +} + /** * Returns the UDP port used for audio streaming. * @@ -1433,6 +1468,16 @@ void linphone_core_set_audio_jittcomp(LinphoneCore *lc, int value) lc->rtp_conf.audio_jitt_comp=value; } +/** + * Sets the nominal video jitter buffer size in milliseconds. + * + * @ingroup media_parameters +**/ +void linphone_core_set_video_jittcomp(LinphoneCore *lc, int value) +{ + lc->rtp_conf.video_jitt_comp=value; +} + void linphone_core_set_rtp_no_xmit_on_audio_mute(LinphoneCore *lc,bool_t rtp_no_xmit_on_audio_mute){ lc->rtp_conf.rtp_no_xmit_on_audio_mute=rtp_no_xmit_on_audio_mute; } @@ -4474,6 +4519,8 @@ void rtp_config_uninit(LinphoneCore *lc) lp_config_set_int(lc->config,"rtp","audio_jitt_comp",config->audio_jitt_comp); lp_config_set_int(lc->config,"rtp","video_jitt_comp",config->video_jitt_comp); lp_config_set_int(lc->config,"rtp","nortp_timeout",config->nortp_timeout); + lp_config_set_int(lc->config,"rtp","audio_jitt_comp_enabled",config->audio_adaptive_jitt_comp_enabled); + lp_config_set_int(lc->config,"rtp","video_jitt_comp_enabled",config->video_adaptive_jitt_comp_enabled); } void sound_config_uninit(LinphoneCore *lc) diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index 984b09d56..98bb03d46 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -903,10 +903,22 @@ void linphone_core_abort_authentication(LinphoneCore *lc, LinphoneAuthInfo *inf void linphone_core_clear_all_auth_info(LinphoneCore *lc); +void linphone_core_enable_audio_adaptive_jittcomp(LinphoneCore *lc, bool_t enable); + +bool_t linphone_core_audio_adaptive_jittcomp_enabled(LinphoneCore *lc); + int linphone_core_get_audio_jittcomp(LinphoneCore *lc); void linphone_core_set_audio_jittcomp(LinphoneCore *lc, int value); +void linphone_core_enable_video_adaptive_jittcomp(LinphoneCore *lc, bool_t enable); + +bool_t linphone_core_video_adaptive_jittcomp_enabled(LinphoneCore *lc); + +int linphone_core_get_video_jittcomp(LinphoneCore *lc); + +void linphone_core_set_video_jittcomp(LinphoneCore *lc, int value); + int linphone_core_get_audio_port(const LinphoneCore *lc); int linphone_core_get_video_port(const LinphoneCore *lc); diff --git a/coreapi/private.h b/coreapi/private.h index b102dc7b5..d1c15e41c 100644 --- a/coreapi/private.h +++ b/coreapi/private.h @@ -369,6 +369,8 @@ typedef struct rtp_config int nortp_timeout; bool_t rtp_no_xmit_on_audio_mute; /* stop rtp xmit when audio muted */ + bool_t audio_adaptive_jitt_comp_enabled; + bool_t video_adaptive_jitt_comp_enabled; }rtp_config_t;