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/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 5a18a0525..9ad1e1776 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; @@ -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/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/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index 63d94411e..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(); @@ -1779,7 +1782,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); } @@ -2165,6 +2168,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/coreapi/private.h b/coreapi/private.h index 925a30360..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); @@ -502,6 +503,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; diff --git a/coreapi/proxy.c b/coreapi/proxy.c index 3b47af42c..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 { @@ -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/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*); 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/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) { diff --git a/java/impl/org/linphone/core/LinphoneCoreImpl.java b/java/impl/org/linphone/core/LinphoneCoreImpl.java index 83f6d20d3..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 { @@ -754,6 +756,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) { 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 bd15866ce..22f54d403 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit bd15866cec3c7b74b359e7a22598c017baf7043e +Subproject commit 22f54d4038fd4ba2897e506be776fe3c0956dd3d diff --git a/oRTP b/oRTP index 59ff6bb7a..b1590514c 160000 --- a/oRTP +++ b/oRTP @@ -1 +1 @@ -Subproject commit 59ff6bb7a0c5047526b802d264f6db4faa2bd5c2 +Subproject commit b1590514c98d33e5464d46317fdeaec52f778de7 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