From 320111b1a43e4831aa54f70208b2f8fef5a95a59 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Fri, 14 Dec 2012 16:29:03 +0100 Subject: [PATCH 01/16] Fix enable low bandwidth jni interface --- coreapi/linphonecore_jni.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index 63d94411e..e83784b74 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -36,7 +36,7 @@ extern "C" { #ifdef ANDROID #include -extern "C" void libmsilbc_init(); +extern "C" void libmsilbc_init();enableca #ifdef HAVE_X264 extern "C" void libmsx264_init(); #endif @@ -1779,7 +1779,7 @@ extern "C" jstring Java_org_linphone_core_LinphoneCoreImpl_getStunServer(JNIEnv //CallParams -extern "C" void Java_org_linphone_core_LinphoneCallImpl_enableLowBandwidth(JNIEnv *env, jobject thiz, jlong cp, jboolean enable) { +extern "C" void Java_org_linphone_core_LinphoneCallParamsImpl_enableLowBandwidth(JNIEnv *env, jobject thiz, jlong cp, jboolean enable) { linphone_call_params_enable_low_bandwidth((LinphoneCallParams *)cp, enable); } From d03b0d01bedf71d153371c58ea3259a3a1cafb11 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Fri, 14 Dec 2012 16:36:24 +0100 Subject: [PATCH 02/16] Remove typo error --- coreapi/linphonecore_jni.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index e83784b74..114d8165c 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -36,7 +36,7 @@ extern "C" { #ifdef ANDROID #include -extern "C" void libmsilbc_init();enableca +extern "C" void libmsilbc_init(); #ifdef HAVE_X264 extern "C" void libmsx264_init(); #endif From ebf0b1897ac114c998a59a3d344417603c25069b Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Mon, 17 Dec 2012 16:32:05 +0100 Subject: [PATCH 03/16] Update ms2 submodule for ICE fix. --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index bd15866ce..517ddc047 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit bd15866cec3c7b74b359e7a22598c017baf7043e +Subproject commit 517ddc04728373f6f0844e45c2b7ade272d33016 From c3495db0f087f93f385db49fe134f6cc816941a4 Mon Sep 17 00:00:00 2001 From: Yann Diorcet Date: Wed, 19 Dec 2012 10:22:24 +0100 Subject: [PATCH 04/16] Update ms2 --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index 517ddc047..9c3f1bdf1 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 517ddc04728373f6f0844e45c2b7ade272d33016 +Subproject commit 9c3f1bdf1f7b51c5eeb020f68ef9a4019c66cc52 From d64c1cc2aa17755cceafc2d67eccf57529b68d19 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Wed, 19 Dec 2012 11:39:22 +0100 Subject: [PATCH 05/16] fix compile bug with xml test tools fix incorrect saving of contact parameters update oRTP --- coreapi/proxy.c | 2 +- mediastreamer2 | 2 +- oRTP | 2 +- tools/Makefile.am | 11 ++++++----- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/coreapi/proxy.c b/coreapi/proxy.c index 3b47af42c..517af502d 100644 --- a/coreapi/proxy.c +++ b/coreapi/proxy.c @@ -981,7 +981,7 @@ void linphone_proxy_config_write_to_config_file(LpConfig *config, LinphoneProxyC lp_config_set_string(config,key,"reg_identity",obj->reg_identity); } if (obj->contact_params!=NULL){ - lp_config_set_string(config,key,"contact_params",obj->contact_params); + lp_config_set_string(config,key,"contact_parameters",obj->contact_params); } lp_config_set_int(config,key,"reg_expires",obj->expires); lp_config_set_int(config,key,"reg_sendregister",obj->reg_sendregister); diff --git a/mediastreamer2 b/mediastreamer2 index 9c3f1bdf1..bd15866ce 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 9c3f1bdf1f7b51c5eeb020f68ef9a4019c66cc52 +Subproject commit bd15866cec3c7b74b359e7a22598c017baf7043e diff --git a/oRTP b/oRTP index 59ff6bb7a..e6436672c 160000 --- a/oRTP +++ b/oRTP @@ -1 +1 @@ -Subproject commit 59ff6bb7a0c5047526b802d264f6db4faa2bd5c2 +Subproject commit e6436672ca7457863f898f0157fa1bd9786051a6 diff --git a/tools/Makefile.am b/tools/Makefile.am index 9e0c94550..e906e29b0 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -7,9 +7,9 @@ AM_CPPFLAGS=\ COMMON_CFLAGS=\ -DIN_LINPHONE \ - $(LIBXML2_CFLAGS) \ $(ORTP_CFLAGS) \ - $(STRICT_OPTIONS) + $(STRICT_OPTIONS) \ + $(LIBXML2_CFLAGS) if BUILD_TOOLS @@ -21,8 +21,8 @@ libxml2lpc_la_SOURCES=\ libxml2lpc_la_CFLAGS=$(COMMON_CFLAGS) libxml2lpc_la_LIBADD=\ - $(LIBXML2_LIBS) \ - $(top_builddir)/coreapi/liblinphone.la + $(top_builddir)/coreapi/liblinphone.la \ + $(LIBXML2_LIBS) libxml2lpc_la_LDFLAGS=-no-undefined @@ -33,7 +33,8 @@ xml2lpc_test_SOURCES=\ xml2lpc_test_CFLAGS=$(COMMON_CFLAGS) xml2lpc_test_LDADD=\ - libxml2lpc.la + $(top_builddir)/coreapi/liblinphone.la \ + libxml2lpc.la endif From 4ec4836fb2f6f23d588cac0f2152056107893feb Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Wed, 19 Dec 2012 14:32:49 +0100 Subject: [PATCH 06/16] do not write to av_profile --- coreapi/linphonecall.c | 2 +- coreapi/linphonecore.c | 22 +++++++++++++--------- coreapi/private.h | 1 + 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index 5a18a0525..ffaf24b5e 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -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; diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index e52fff00e..c1475c569 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -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;idefault_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); diff --git a/coreapi/private.h b/coreapi/private.h index 925a30360..43e4b2227 100644 --- a/coreapi/private.h +++ b/coreapi/private.h @@ -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; From 9a39c3b832f7765e838a56766de92e5bbc7d15b6 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Wed, 19 Dec 2012 21:08:23 +0100 Subject: [PATCH 07/16] update oRTP (compile bugfix) --- oRTP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oRTP b/oRTP index e6436672c..710e5d051 160000 --- a/oRTP +++ b/oRTP @@ -1 +1 @@ -Subproject commit e6436672ca7457863f898f0157fa1bd9786051a6 +Subproject commit 710e5d0513649b6daa844d688b249cfd8b4293a7 From 58fa072da01bb94f660d6a4511888b1eb61f7102 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Thu, 20 Dec 2012 11:36:31 +0100 Subject: [PATCH 08/16] update oRTP --- oRTP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oRTP b/oRTP index 710e5d051..b1590514c 160000 --- a/oRTP +++ b/oRTP @@ -1 +1 @@ -Subproject commit 710e5d0513649b6daa844d688b249cfd8b4293a7 +Subproject commit b1590514c98d33e5464d46317fdeaec52f778de7 From 8f60c4c9ad63e705f9d85310e75b2a21d567aae8 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Fri, 21 Dec 2012 16:31:40 +0100 Subject: [PATCH 09/16] Allow update of SRTP crypto keys without restarting the media streams. --- coreapi/callbacks.c | 57 ++++++++++++++++++++++++------------------ coreapi/linphonecall.c | 46 ++++++++++++++++++++++++++++++++++ coreapi/private.h | 1 + coreapi/sal.c | 8 ++++++ coreapi/sal.h | 3 ++- 5 files changed, 90 insertions(+), 25 deletions(-) diff --git a/coreapi/callbacks.c b/coreapi/callbacks.c index 134c336ab..f9399553f 100644 --- a/coreapi/callbacks.c +++ b/coreapi/callbacks.c @@ -104,31 +104,40 @@ void linphone_core_update_streams(LinphoneCore *lc, LinphoneCall *call, SalMedia /* we already started media: check if we really need to restart it*/ if (oldmd){ int md_changed = media_parameters_changed(call, oldmd, new_md); - if ((md_changed == SAL_MEDIA_DESCRIPTION_UNCHANGED) && !call->playing_ringbacktone) { - /*as nothing has changed, keep the oldmd */ - call->resultdesc=oldmd; - sal_media_description_unref(new_md); - if (call->all_muted){ - ms_message("Early media finished, unmuting inputs..."); - /*we were in early media, now we want to enable real media */ - linphone_call_enable_camera (call,linphone_call_camera_enabled (call)); - if (call->audiostream) - linphone_core_mute_mic (lc, linphone_core_is_mic_muted(lc)); -#ifdef VIDEO_ENABLED - if (call->videostream && call->camera_active) - video_stream_change_camera(call->videostream,lc->video_conf.device ); -#endif - } - ms_message("No need to restart streams, SDP is unchanged."); - return; - } else if ((md_changed == SAL_MEDIA_DESCRIPTION_NETWORK_CHANGED) && !call->playing_ringbacktone) { - call->resultdesc = oldmd; - ms_message("Network parameters have changed, update them."); - linphone_core_update_streams_destinations(lc, call, oldmd, new_md); - sal_media_description_unref(new_md); - return; - }else{ + if ((md_changed & SAL_MEDIA_DESCRIPTION_CODEC_CHANGED) || call->playing_ringbacktone) { ms_message("Media descriptions are different, need to restart the streams."); + } else { + if (md_changed == SAL_MEDIA_DESCRIPTION_UNCHANGED) { + /*as nothing has changed, keep the oldmd */ + call->resultdesc=oldmd; + sal_media_description_unref(new_md); + if (call->all_muted){ + ms_message("Early media finished, unmuting inputs..."); + /*we were in early media, now we want to enable real media */ + linphone_call_enable_camera (call,linphone_call_camera_enabled (call)); + if (call->audiostream) + linphone_core_mute_mic (lc, linphone_core_is_mic_muted(lc)); +#ifdef VIDEO_ENABLED + if (call->videostream && call->camera_active) + video_stream_change_camera(call->videostream,lc->video_conf.device ); +#endif + } + ms_message("No need to restart streams, SDP is unchanged."); + return; + } + else { + if (md_changed & SAL_MEDIA_DESCRIPTION_NETWORK_CHANGED) { + ms_message("Network parameters have changed, update them."); + linphone_core_update_streams_destinations(lc, call, oldmd, new_md); + } + if (md_changed & SAL_MEDIA_DESCRIPTION_CRYPTO_CHANGED) { + ms_message("Crypto parameters have changed, update them."); + linphone_call_update_crypto_parameters(call, oldmd, new_md); + } + call->resultdesc = oldmd; + sal_media_description_unref(new_md); + return; + } } } linphone_call_stop_media_streams (call); diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index ffaf24b5e..9ad1e1776 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -1658,6 +1658,52 @@ void linphone_call_stop_media_streams_for_ice_gathering(LinphoneCall *call){ #endif } +void linphone_call_update_crypto_parameters(LinphoneCall *call, SalMediaDescription *old_md, SalMediaDescription *new_md) { + SalStreamDescription *old_stream; + SalStreamDescription *new_stream; + int i; + + old_stream = sal_media_description_find_stream(old_md, SalProtoRtpSavp, SalAudio); + new_stream = sal_media_description_find_stream(new_md, SalProtoRtpSavp, SalAudio); + if (old_stream && new_stream) { + const SalStreamDescription *local_st_desc = sal_media_description_find_stream(call->localdesc, SalProtoRtpSavp, SalAudio); + int crypto_idx = find_crypto_index_from_tag(local_st_desc->crypto, new_stream->crypto_local_tag); + if (crypto_idx >= 0) { + audio_stream_enable_strp(call->audiostream, new_stream->crypto[0].algo, local_st_desc->crypto[crypto_idx].master_key, new_stream->crypto[0].master_key); + call->audiostream_encrypted = TRUE; + } else { + ms_warning("Failed to find local crypto algo with tag: %d", new_stream->crypto_local_tag); + call->audiostream_encrypted = FALSE; + } + for (i = 0; i < SAL_CRYPTO_ALGO_MAX; i++) { + old_stream->crypto[i].tag = new_stream->crypto[i].tag; + old_stream->crypto[i].algo = new_stream->crypto[i].algo; + strncpy(old_stream->crypto[i].master_key, new_stream->crypto[i].master_key, sizeof(old_stream->crypto[i].master_key) - 1); + } + } + +#ifdef VIDEO_ENABLED + old_stream = sal_media_description_find_stream(old_md, SalProtoRtpSavp, SalVideo); + new_stream = sal_media_description_find_stream(new_md, SalProtoRtpSavp, SalVideo); + if (old_stream && new_stream) { + const SalStreamDescription *local_st_desc = sal_media_description_find_stream(call->localdesc, SalProtoRtpSavp, SalVideo); + int crypto_idx = find_crypto_index_from_tag(local_st_desc->crypto, new_stream->crypto_local_tag); + if (crypto_idx >= 0) { + video_stream_enable_strp(call->videostream, new_stream->crypto[0].algo, local_st_desc->crypto[crypto_idx].master_key, new_stream->crypto[0].master_key); + call->videostream_encrypted = TRUE; + } else { + ms_warning("Failed to find local crypto algo with tag: %d", new_stream->crypto_local_tag); + call->videostream_encrypted = FALSE; + } + for (i = 0; i < SAL_CRYPTO_ALGO_MAX; i++) { + old_stream->crypto[i].tag = new_stream->crypto[i].tag; + old_stream->crypto[i].algo = new_stream->crypto[i].algo; + strncpy(old_stream->crypto[i].master_key, new_stream->crypto[i].master_key, sizeof(old_stream->crypto[i].master_key) - 1); + } + } +#endif +} + void linphone_call_delete_ice_session(LinphoneCall *call){ if (call->ice_session != NULL) { ice_session_destroy(call->ice_session); diff --git a/coreapi/private.h b/coreapi/private.h index 43e4b2227..c171fac88 100644 --- a/coreapi/private.h +++ b/coreapi/private.h @@ -285,6 +285,7 @@ void linphone_call_stop_video_stream(LinphoneCall *call); void linphone_call_stop_media_streams(LinphoneCall *call); void linphone_call_delete_ice_session(LinphoneCall *call); void linphone_call_stop_media_streams_for_ice_gathering(LinphoneCall *call); +void linphone_call_update_crypto_parameters(LinphoneCall *call, SalMediaDescription *old_md, SalMediaDescription *new_md); const char * linphone_core_get_identity(LinphoneCore *lc); const char * linphone_core_get_route(LinphoneCore *lc); diff --git a/coreapi/sal.c b/coreapi/sal.c index f46d9a556..7a3bbdf7b 100644 --- a/coreapi/sal.c +++ b/coreapi/sal.c @@ -189,10 +189,18 @@ static bool_t payload_list_equals(const MSList *l1, const MSList *l2){ int sal_stream_description_equals(const SalStreamDescription *sd1, const SalStreamDescription *sd2) { int result = SAL_MEDIA_DESCRIPTION_UNCHANGED; + int i; /* A different proto should result in SAL_MEDIA_DESCRIPTION_NETWORK_CHANGED but the encryption change needs a stream restart for now, so use SAL_MEDIA_DESCRIPTION_CODEC_CHANGED */ if (sd1->proto != sd2->proto) result |= SAL_MEDIA_DESCRIPTION_CODEC_CHANGED; + for (i = 0; i < SAL_CRYPTO_ALGO_MAX; i++) { + if ((sd1->crypto[i].tag != sd2->crypto[i].tag) + || (sd1->crypto[i].algo != sd2->crypto[i].algo) + || (strncmp(sd1->crypto[i].master_key, sd2->crypto[i].master_key, sizeof(sd1->crypto[i].master_key) - 1))) { + result |= SAL_MEDIA_DESCRIPTION_CRYPTO_CHANGED; + } + } if (sd1->type != sd2->type) result |= SAL_MEDIA_DESCRIPTION_CODEC_CHANGED; if (strcmp(sd1->rtp_addr, sd2->rtp_addr) != 0) result |= SAL_MEDIA_DESCRIPTION_NETWORK_CHANGED; diff --git a/coreapi/sal.h b/coreapi/sal.h index daa59217a..77e43d6b1 100644 --- a/coreapi/sal.h +++ b/coreapi/sal.h @@ -56,7 +56,8 @@ typedef enum { #define SAL_MEDIA_DESCRIPTION_UNCHANGED 0x00 #define SAL_MEDIA_DESCRIPTION_NETWORK_CHANGED 0x01 #define SAL_MEDIA_DESCRIPTION_CODEC_CHANGED 0x02 -#define SAL_MEDIA_DESCRIPTION_CHANGED (SAL_MEDIA_DESCRIPTION_NETWORK_CHANGED | SAL_MEDIA_DESCRIPTION_CODEC_CHANGED) +#define SAL_MEDIA_DESCRIPTION_CRYPTO_CHANGED 0x04 +#define SAL_MEDIA_DESCRIPTION_CHANGED (SAL_MEDIA_DESCRIPTION_NETWORK_CHANGED | SAL_MEDIA_DESCRIPTION_CODEC_CHANGED | SAL_MEDIA_DESCRIPTION_CRYPTO_CHANGED) const char* sal_transport_to_string(SalTransport transport); SalTransport sal_transport_parse(const char*); From 722a616f6adc85885e3ebd4bfb3eb3ec9fb1817b Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Fri, 21 Dec 2012 16:32:49 +0100 Subject: [PATCH 10/16] Update ms2 submodule. --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index bd15866ce..49ffa1905 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit bd15866cec3c7b74b359e7a22598c017baf7043e +Subproject commit 49ffa1905460cb74725bbf5be20b4786de7fb5b6 From eb27f4c3c9c003114e8340b9192d0bc96041d69c Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Fri, 21 Dec 2012 17:17:00 +0100 Subject: [PATCH 11/16] Add JNI to set static picture. --- coreapi/linphonecore_jni.cc | 6 ++++++ java/common/org/linphone/core/LinphoneCore.java | 4 +++- java/impl/org/linphone/core/LinphoneCoreImpl.java | 4 ++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index 114d8165c..5bdcbfe33 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -2165,6 +2165,12 @@ extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setVideoPolicy(JNIEnv *e linphone_core_set_video_policy((LinphoneCore *)lc, &vpol); } +extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setStaticPicture(JNIEnv *env, jobject thiz, jlong lc, jstring path) { + const char *cpath = env->GetStringUTFChars(path, NULL); + linphone_core_set_static_picture((LinphoneCore *)lc, cpath); + env->ReleaseStringUTFChars(path, cpath); +} + extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setCpuCountNative(JNIEnv *env, jobject thiz, jint count) { ms_set_cpu_count(count); } diff --git a/java/common/org/linphone/core/LinphoneCore.java b/java/common/org/linphone/core/LinphoneCore.java index 8815085d0..d612589fe 100644 --- a/java/common/org/linphone/core/LinphoneCore.java +++ b/java/common/org/linphone/core/LinphoneCore.java @@ -786,7 +786,9 @@ public interface LinphoneCore { LinphoneProxyConfig[] getProxyConfigList(); void setVideoPolicy(boolean autoInitiate, boolean autoAccept); - + + void setStaticPicture(String path); + void setUserAgent(String name, String version); void setCpuCount(int count); diff --git a/java/impl/org/linphone/core/LinphoneCoreImpl.java b/java/impl/org/linphone/core/LinphoneCoreImpl.java index 83f6d20d3..64db42ee3 100644 --- a/java/impl/org/linphone/core/LinphoneCoreImpl.java +++ b/java/impl/org/linphone/core/LinphoneCoreImpl.java @@ -754,6 +754,10 @@ class LinphoneCoreImpl implements LinphoneCore { public synchronized void setVideoPolicy(boolean autoInitiate, boolean autoAccept) { setVideoPolicy(nativePtr, autoInitiate, autoAccept); } + private native void setStaticPicture(long nativePtr, String path); + public void setStaticPicture(String path) { + setStaticPicture(nativePtr, path); + } private native void setUserAgent(long nativePtr, String name, String version); @Override public void setUserAgent(String name, String version) { From 855de73c8bfa04187659e18a8b74615b653457f0 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Thu, 27 Dec 2012 11:15:53 +0100 Subject: [PATCH 12/16] Moved Log java class from linphone core to mediastreamer --- java/impl/org/linphone/core/Log.java | 112 --------------------------- mediastreamer2 | 2 +- 2 files changed, 1 insertion(+), 113 deletions(-) delete mode 100644 java/impl/org/linphone/core/Log.java diff --git a/java/impl/org/linphone/core/Log.java b/java/impl/org/linphone/core/Log.java deleted file mode 100644 index b70b65931..000000000 --- a/java/impl/org/linphone/core/Log.java +++ /dev/null @@ -1,112 +0,0 @@ -/* -Log.java -Copyright (C) 2011 Belledonne Communications, Grenoble, France - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -package org.linphone.core; - -import static android.util.Log.DEBUG; -import static android.util.Log.ERROR; -import static android.util.Log.INFO; -import static android.util.Log.WARN; - -/** - * Convenient wrapper for Android logs. - * - * @author Guillaume Beraudo - */ -public final class Log { - - public static final String TAG = "Linphone"; - private static final boolean useIsLoggable = false; - - @SuppressWarnings(value="all") - private static boolean isLoggable(int level) { - return !useIsLoggable || android.util.Log.isLoggable(TAG, level); - } - - public static void i(Object...objects) { - if (isLoggable(INFO)) { - android.util.Log.i(TAG, toString(objects)); - } - } - public static void i(Throwable t, Object...objects) { - if (isLoggable(INFO)) { - android.util.Log.i(TAG, toString(objects), t); - } - } - - - public static void d(Object...objects) { - if (isLoggable(DEBUG)) { - android.util.Log.d(TAG, toString(objects)); - } - } - public static void d(Throwable t, Object...objects) { - if (isLoggable(DEBUG)) { - android.util.Log.d(TAG, toString(objects), t); - } - } - - public static void w(Object...objects) { - if (isLoggable(WARN)) { - android.util.Log.w(TAG, toString(objects)); - } - } - public static void w(Throwable t, Object...objects) { - if (isLoggable(WARN)) { - android.util.Log.w(TAG, toString(objects), t); - } - } - - public static void e(Object...objects) { - if (isLoggable(ERROR)) { - android.util.Log.e(TAG, toString(objects)); - } - } - public static void e(Throwable t, Object...objects) { - if (isLoggable(ERROR)) { - android.util.Log.e(TAG, toString(objects), t); - } - } - - /** - * @throws RuntimeException always throw after logging the error message. - */ - public static void f(Object...objects) { - if (isLoggable(ERROR)) { - android.util.Log.e(TAG, toString(objects)); - throw new RuntimeException("Fatal error : " + toString(objects)); - } - } - /** - * @throws RuntimeException always throw after logging the error message. - */ - public static void f(Throwable t, Object...objects) { - if (isLoggable(ERROR)) { - android.util.Log.e(TAG, toString(objects), t); - throw new RuntimeException("Fatal error : " + toString(objects), t); - } - } - - private static String toString(Object...objects) { - StringBuilder sb = new StringBuilder(); - for (Object o : objects) { - sb.append(o); - } - return sb.toString(); - } -} diff --git a/mediastreamer2 b/mediastreamer2 index 49ffa1905..ce4abb792 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 49ffa1905460cb74725bbf5be20b4786de7fb5b6 +Subproject commit ce4abb79231bc1da097be70c93755ded9195701c From 8afceff48b751faa7680e8a790066b37f864482c Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Thu, 27 Dec 2012 11:20:43 +0100 Subject: [PATCH 13/16] Renamed Log package in imports --- java/impl/org/linphone/core/LinphoneCoreImpl.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/java/impl/org/linphone/core/LinphoneCoreImpl.java b/java/impl/org/linphone/core/LinphoneCoreImpl.java index 64db42ee3..d4f7808c6 100644 --- a/java/impl/org/linphone/core/LinphoneCoreImpl.java +++ b/java/impl/org/linphone/core/LinphoneCoreImpl.java @@ -20,15 +20,17 @@ package org.linphone.core; import static android.media.AudioManager.MODE_IN_CALL; import static android.media.AudioManager.MODE_RINGTONE; -import android.content.Context; -import android.media.AudioManager; import java.io.File; import java.io.IOException; import org.linphone.core.LinphoneCall.State; +import org.linphone.mediastream.Log; import org.linphone.mediastream.video.capture.hwconf.Hacks; +import android.content.Context; +import android.media.AudioManager; + class LinphoneCoreImpl implements LinphoneCore { From 03ce0e5b59095b6fb2199969ccfb34163ef5858c Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Thu, 27 Dec 2012 11:41:00 +0100 Subject: [PATCH 14/16] Update ms2 --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index ce4abb792..22f54d403 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit ce4abb79231bc1da097be70c93755ded9195701c +Subproject commit 22f54d4038fd4ba2897e506be776fe3c0956dd3d From 414fcf3841ee6c3b69cb9d52b35bdf6ef97a8ef7 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Thu, 27 Dec 2012 12:18:02 +0100 Subject: [PATCH 15/16] TAG for android traces can be specified through JNI interface --- build/android/common.mk | 5 ----- coreapi/linphonecore_jni.cc | 11 +++++++---- .../common/org/linphone/core/LinphoneCoreFactory.java | 3 ++- .../org/linphone/core/LinphoneCoreFactoryImpl.java | 2 +- 4 files changed, 10 insertions(+), 11 deletions(-) diff --git a/build/android/common.mk b/build/android/common.mk index 99e1787a7..d629b54af 100644 --- a/build/android/common.mk +++ b/build/android/common.mk @@ -46,10 +46,6 @@ LOCAL_SRC_FILES := \ ec-calibrator.c \ linphone_tunnel.cc -ifndef MY_LOG_DOMAIN -MY_LOG_DOMAIN = \"Linphone\" -endif - ifndef LINPHONE_VERSION LINPHONE_VERSION = "Devel" endif @@ -64,7 +60,6 @@ LOCAL_CFLAGS += \ -DENABLE_TRACE \ -DLINPHONE_VERSION=\"$(LINPHONE_VERSION)\" \ -DLINPHONE_PLUGINS_DIR=\"\\tmp\" \ - -DLOG_DOMAIN=$(MY_LOG_DOMAIN) \ -DHAVE_EXOSIP_TRYLOCK=1 \ -DHAVE_EXOSIP_TLS_VERIFY_CERTIFICATE=1 diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index 5bdcbfe33..102d21777 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -52,6 +52,7 @@ extern "C" void libmsbcg729_init(); #endif /*ANDROID*/ static JavaVM *jvm=0; +static const char* LogDomain = "Linphone"; #ifdef ANDROID static void linphone_android_log_handler(OrtpLogLevel lev, const char *fmt, va_list args){ @@ -70,15 +71,15 @@ static void linphone_android_log_handler(OrtpLogLevel lev, const char *fmt, va_l vsnprintf(str, sizeof(str) - 1, fmt, args); str[sizeof(str) - 1] = '\0'; if (strlen(str) < 512) { - __android_log_write(prio, LOG_DOMAIN, str); + __android_log_write(prio, LogDomain, str); } else { current = str; while ((next = strchr(current, '\n')) != NULL) { *next = '\0'; - __android_log_write(prio, LOG_DOMAIN, current); + __android_log_write(prio, LogDomain, current); current = next + 1; } - __android_log_write(prio, LOG_DOMAIN, current); + __android_log_write(prio, LogDomain, current); } } @@ -100,8 +101,10 @@ JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *ajvm, void *reserved) //LinphoneFactory extern "C" void Java_org_linphone_core_LinphoneCoreFactoryImpl_setDebugMode(JNIEnv* env ,jobject thiz - ,jboolean isDebug) { + ,jboolean isDebug + ,jstring jdebugTag) { if (isDebug) { + LogDomain = env->GetStringUTFChars(jdebugTag, NULL); linphone_core_enable_logs_with_cb(linphone_android_log_handler); } else { linphone_core_disable_logs(); diff --git a/java/common/org/linphone/core/LinphoneCoreFactory.java b/java/common/org/linphone/core/LinphoneCoreFactory.java index 04cef4aea..100794016 100644 --- a/java/common/org/linphone/core/LinphoneCoreFactory.java +++ b/java/common/org/linphone/core/LinphoneCoreFactory.java @@ -72,8 +72,9 @@ abstract public class LinphoneCoreFactory { /** * Enable verbose traces * @param enable + * @param tag */ - abstract public void setDebugMode(boolean enable); + abstract public void setDebugMode(boolean enable, String tag); abstract public void setLogHandler(LinphoneLogHandler handler); /** diff --git a/java/impl/org/linphone/core/LinphoneCoreFactoryImpl.java b/java/impl/org/linphone/core/LinphoneCoreFactoryImpl.java index a99509fa3..b719f0f70 100644 --- a/java/impl/org/linphone/core/LinphoneCoreFactoryImpl.java +++ b/java/impl/org/linphone/core/LinphoneCoreFactoryImpl.java @@ -131,7 +131,7 @@ public class LinphoneCoreFactoryImpl extends LinphoneCoreFactory { } @Override - public native void setDebugMode(boolean enable); + public native void setDebugMode(boolean enable, String tag); @Override public void setLogHandler(LinphoneLogHandler handler) { From 271e68f16a1341d45493c51a0ee1bd410c6734d4 Mon Sep 17 00:00:00 2001 From: Yann Diorcet Date: Thu, 3 Jan 2013 08:48:10 +0100 Subject: [PATCH 16/16] Fix dial plan e164 infinite loop --- coreapi/proxy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreapi/proxy.c b/coreapi/proxy.c index 517af502d..a109a3be2 100644 --- a/coreapi/proxy.c +++ b/coreapi/proxy.c @@ -625,7 +625,7 @@ int linphone_dial_plan_lookup_ccc_from_e164(const char* e164) { found++; } } - } while (found>1 || found==0); + } while ((found>1 || found==0) && i < sizeof(dial_plan->ccc)); if (found==1) { return atoi(elected_dial_plan->ccc); } else {