From 9a8ee6ddf56d7b4aea02cfaaa1bac94b63c05ed9 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Tue, 19 Jan 2016 16:25:21 +0100 Subject: [PATCH] update for new ortp logging api --- configure.ac | 2 +- coreapi/bellesip_sal/sal_impl.c | 4 ++-- coreapi/linphone_tunnel.cc | 6 +++--- coreapi/linphonecall.c | 27 ++++++++++++--------------- coreapi/linphonecore.c | 10 +++++----- coreapi/upnp.c | 2 +- gtk/main.c | 4 +++- mediastreamer2 | 2 +- oRTP | 2 +- tester/liblinphone_tester.c | 4 ++-- 10 files changed, 31 insertions(+), 32 deletions(-) diff --git a/configure.ac b/configure.ac index 3932ab2e1..8392b79f4 100644 --- a/configure.ac +++ b/configure.ac @@ -17,7 +17,7 @@ if test "$LINPHONE_EXTRA_VERSION" != "" ;then LINPHONE_VERSION=$LINPHONE_VERSION.${LINPHONE_EXTRA_VERSION} fi -LIBLINPHONE_SO_CURRENT=8 dnl increment this number when you add/change/remove an interface +LIBLINPHONE_SO_CURRENT=9 dnl increment this number when you add/change/remove an interface LIBLINPHONE_SO_REVISION=0 dnl increment this number when you change source code, without changing interfaces; set to 0 when incrementing CURRENT LIBLINPHONE_SO_AGE=0 dnl increment this number when you add an interface, set to 0 if you remove an interface diff --git a/coreapi/bellesip_sal/sal_impl.c b/coreapi/bellesip_sal/sal_impl.c index c98dbec7f..123aadb3a 100644 --- a/coreapi/bellesip_sal/sal_impl.c +++ b/coreapi/bellesip_sal/sal_impl.c @@ -82,8 +82,8 @@ void _belle_sip_log(belle_sip_log_level lev, const char *fmt, va_list args) { ortp_level=ORTP_DEBUG; break; } - if (ortp_log_level_enabled(ortp_level)){ - ortp_logv(ortp_level,fmt,args); + if (ortp_log_level_enabled("belle-sip", ortp_level)){ + ortp_logv("belle-sip", ortp_level,fmt,args); } } diff --git a/coreapi/linphone_tunnel.cc b/coreapi/linphone_tunnel.cc index 6cedfc2fd..a751bc948 100644 --- a/coreapi/linphone_tunnel.cc +++ b/coreapi/linphone_tunnel.cc @@ -289,7 +289,7 @@ static void tunnelLogHandler(int level, const char *fmt, va_list l){ ms_fatal("Unexepcted tunnel log %i: %s",level,fmt); break; } - tunnelOrtpLogHandler(ortp_level,fmt,l); + tunnelOrtpLogHandler("tunnel", ortp_level,fmt,l); } } @@ -330,8 +330,8 @@ bool_t linphone_tunnel_sip_enabled(const LinphoneTunnel *tunnel) { return bcTunnel(tunnel)->tunnelizeSipPacketsEnabled() ? TRUE : FALSE; } -static void my_ortp_logv(OrtpLogLevel level, const char *fmt, va_list args){ - ortp_logv(level,fmt,args); +static void my_ortp_logv(const char *domain, OrtpLogLevel level, const char *fmt, va_list args){ + ortp_logv(domain, level,fmt,args); } diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index afca10d01..ad528728a 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -527,22 +527,19 @@ static void setup_rtcp_fb(LinphoneCall *call, SalMediaDescription *md) { if (!sal_stream_description_active(&md->streams[i])) continue; md->streams[i].rtcp_fb.generic_nack_enabled = lp_config_get_int(lc->config, "rtp", "rtcp_fb_generic_nack_enabled", 0); md->streams[i].rtcp_fb.tmmbr_enabled = lp_config_get_int(lc->config, "rtp", "rtcp_fb_tmmbr_enabled", 0); - md->streams[i].implicit_rtcp_fb = call->params->implicit_rtcp_fb; - - for (pt_it = md->streams[i].payloads; pt_it != NULL; pt_it = pt_it->next) { + md->streams[i].implicit_rtcp_fb = call->params->implicit_rtcp_fb; + + for (pt_it = md->streams[i].payloads; pt_it != NULL; pt_it = pt_it->next) { pt = (PayloadType *)pt_it->data; - - if (call->params->avpf_enabled == FALSE && call->params->implicit_rtcp_fb == FALSE) { - payload_type_unset_flag(pt, PAYLOAD_TYPE_RTCP_FEEDBACK_ENABLED); - memset(&avpf_params, 0, sizeof(avpf_params)); - } - else { - payload_type_set_flag(pt, PAYLOAD_TYPE_RTCP_FEEDBACK_ENABLED); - avpf_params = payload_type_get_avpf_params(pt); - avpf_params.trr_interval = call->params->avpf_rr_interval; - - } - + + if (call->params->avpf_enabled == FALSE && call->params->implicit_rtcp_fb == FALSE) { + payload_type_unset_flag(pt, PAYLOAD_TYPE_RTCP_FEEDBACK_ENABLED); + memset(&avpf_params, 0, sizeof(avpf_params)); + }else { + payload_type_set_flag(pt, PAYLOAD_TYPE_RTCP_FEEDBACK_ENABLED); + avpf_params = payload_type_get_avpf_params(pt); + avpf_params.trr_interval = call->params->avpf_rr_interval; + } payload_type_set_avpf_params(pt, avpf_params); } } diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 633360a7a..580940738 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -163,7 +163,7 @@ const LinphoneAddress *linphone_core_get_current_call_remote_address(struct _Lin return linphone_call_get_remote_address(call); } -static void linphone_core_log_collection_handler(OrtpLogLevel level, const char *fmt, va_list args); +static void linphone_core_log_collection_handler(const char *domain, OrtpLogLevel level, const char *fmt, va_list args); void linphone_core_set_log_handler(OrtpLogFunc logfunc) { if (ortp_logv_out == linphone_core_log_collection_handler) { @@ -200,7 +200,7 @@ void linphone_core_set_log_level(OrtpLogLevel loglevel) { } void linphone_core_set_log_level_mask(OrtpLogLevel loglevel) { - ortp_set_log_level_mask(loglevel); + ortp_set_log_level_mask(NULL, loglevel); if (loglevel == 0) { sal_disable_log(); } else { @@ -263,7 +263,7 @@ static void _close_log_collection_file(void) { } } -static void linphone_core_log_collection_handler(OrtpLogLevel level, const char *fmt, va_list args) { +static void linphone_core_log_collection_handler(const char *domain, OrtpLogLevel level, const char *fmt, va_list args) { const char *lname="undef"; char *msg; struct timeval tp; @@ -275,12 +275,12 @@ static void linphone_core_log_collection_handler(OrtpLogLevel level, const char #ifndef _WIN32 va_list args_copy; va_copy(args_copy, args); - liblinphone_log_func(level, fmt, args_copy); + liblinphone_log_func(domain, level, fmt, args_copy); va_end(args_copy); #else /* This works on 32 bits, luckily. */ /* TODO: va_copy is available in Visual Studio 2013. */ - liblinphone_log_func(level, fmt, args); + liblinphone_log_func(domain, level, fmt, args); #endif } diff --git a/coreapi/upnp.c b/coreapi/upnp.c index 72257ac60..5ec118247 100644 --- a/coreapi/upnp.c +++ b/coreapi/upnp.c @@ -189,7 +189,7 @@ void linphone_upnp_igd_print(void *cookie, upnp_igd_print_level level, const cha default: break; } - ortp_logv(ortp_level, fmt, list); + ortp_logv(ORTP_LOG_DOMAIN, ortp_level, fmt, list); } void linphone_upnp_igd_callback(void *cookie, upnp_igd_event event, void *arg) { diff --git a/gtk/main.c b/gtk/main.c index 9ba13b2d9..5a170a552 100644 --- a/gtk/main.c +++ b/gtk/main.c @@ -1888,7 +1888,7 @@ static void linphone_gtk_init_main_window(void){ #endif } -void linphone_gtk_log_handler(OrtpLogLevel lev, const char *fmt, va_list args){ +void linphone_gtk_log_handler(const char*domain, OrtpLogLevel lev, const char *fmt, va_list args){ if (verbose){ const char *lname="undef"; char *msg; @@ -2199,6 +2199,8 @@ core_start: linphone_gtk_create_log_window(); linphone_core_enable_logs_with_cb(linphone_gtk_log_handler); + /*it is possible to filter in or out some logs by configuring per log domain:*/ + /*ortp_set_log_level_mask("belle-sip", ORTP_ERROR);*/ chat_messages_db_file=linphone_gtk_message_storage_get_db_file(NULL); call_logs_db_file = linphone_gtk_call_logs_storage_get_db_file(NULL); diff --git a/mediastreamer2 b/mediastreamer2 index d948afeba..2e78b3514 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit d948afeba99b3203d5dfeb967a9b7950d3be91f8 +Subproject commit 2e78b3514324ae6311f437926e5ff2fc2da09344 diff --git a/oRTP b/oRTP index d51e5aa8c..0c8d9ddae 160000 --- a/oRTP +++ b/oRTP @@ -1 +1 @@ -Subproject commit d51e5aa8c24a8dd9e3a7bd9995a9f6fb070bda06 +Subproject commit 0c8d9ddaea8c1afdc0e9b8c37a31c9d158e57efd diff --git a/tester/liblinphone_tester.c b/tester/liblinphone_tester.c index 2363fb886..f6531ea75 100644 --- a/tester/liblinphone_tester.c +++ b/tester/liblinphone_tester.c @@ -73,7 +73,7 @@ void liblinphone_android_log_handler(int prio, const char *fmt, va_list args) { } } -static void liblinphone_android_ortp_log_handler(OrtpLogLevel lev, const char *fmt, va_list args) { +static void liblinphone_android_ortp_log_handler(const char *domain, OrtpLogLevel lev, const char *fmt, va_list args) { int prio; switch(lev){ case ORTP_DEBUG: prio = ANDROID_LOG_DEBUG; break; @@ -151,7 +151,7 @@ static void log_handler(int lev, const char *fmt, va_list args) { va_end(cap); #endif if (log_file){ - ortp_logv_out(lev, fmt, args); + ortp_logv_out(ORTP_LOG_DOMAIN, lev, fmt, args); } }