Commit a60d967d authored by Sylvain Berfini's avatar Sylvain Berfini 🎩

Merge branch 'master' into dev_continuous_bw_measurement

parents 5957051e 4b0eb84c
......@@ -37,10 +37,16 @@ if(@ENABLE_SHARED@)
set(ORTP_LIBRARIES ${ORTP_TARGETNAME})
else()
set(ORTP_TARGETNAME ortp-static)
get_target_property(ORTP_LIBRARIES ${ORTP_TARGETNAME} LOCATION)
get_target_property(ORTP_LINK_LIBRARIES ${ORTP_TARGETNAME} INTERFACE_LINK_LIBRARIES)
if(ORTP_LINK_LIBRARIES)
list(APPEND ORTP_LIBRARIES ${ORTP_LINK_LIBRARIES})
if(TARGET ${ORTP_TARGETNAME})
if(LINPHONE_BUILDER_GROUP_EXTERNAL_SOURCE_PATH_BUILDERS)
set(ORTP_LIBRARIES ${ORTP_TARGETNAME})
else()
get_target_property(ORTP_LIBRARIES ${ORTP_TARGETNAME} LOCATION)
endif()
get_target_property(ORTP_LINK_LIBRARIES ${ORTP_TARGETNAME} INTERFACE_LINK_LIBRARIES)
if(ORTP_LINK_LIBRARIES)
list(APPEND ORTP_LIBRARIES ${ORTP_LINK_LIBRARIES})
endif()
endif()
endif()
get_target_property(ORTP_INCLUDE_DIRS ${ORTP_TARGETNAME} INTERFACE_INCLUDE_DIRECTORIES)
......
......@@ -44,11 +44,12 @@ struct _OrtpEventData{
bool_t dtls_stream_encrypted;
bool_t zrtp_stream_encrypted;
bool_t ice_processing_successful;
struct _ZrtpSas{
struct _ZrtpInfo{
char sas[32]; // up to 31 + null characters
bool_t verified;
bool_t pad[3];
} zrtp_sas;
bool_t cache_mismatch;
bool_t pad[2];
} zrtp_info;
OrtpSocketType socket_type;
uint32_t received_rtt_character;
bool_t congestion_detected;
......@@ -81,7 +82,9 @@ ORTP_PUBLIC OrtpEventType ortp_event_get_type(const OrtpEvent *ev);
#define ORTP_EVENT_DTLS_ENCRYPTION_CHANGED 13
#define ORTP_EVENT_RTT_CHARACTER_RECEIVED 15
#define ORTP_EVENT_CONGESTION_STATE_CHANGED 16
#define ORTP_EVENT_NEW_VIDEO_BANDWIDTH_ESTIMATION_AVAILABLE 17
#define ORTP_EVENT_ZRTP_CACHE_MISMATCH 17
#define ORTP_EVENT_ZRTP_PEER_VERSION_OBSOLETE 18
#define ORTP_EVENT_NEW_VIDEO_BANDWIDTH_ESTIMATION_AVAILABLE 19
ORTP_PUBLIC OrtpEventData * ortp_event_get_data(OrtpEvent *ev);
ORTP_PUBLIC void ortp_event_destroy(OrtpEvent *ev);
......
......@@ -21,6 +21,9 @@
#ifndef ORTP_PORT_H
#define ORTP_PORT_H
#if __APPLE__
#include "TargetConditionals.h"
#endif
#if !defined(_WIN32) && !defined(_WIN32_WCE)
/********************************/
......@@ -385,7 +388,7 @@ ORTP_PUBLIC bool_t ortp_is_multicast_addr(const struct sockaddr *addr);
/*define __ios when we are compiling for ios.
The TARGET_OS_IPHONE macro is stupid, it is defined to 0 when compiling on mac os x.
*/
#if defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE==1
#if TARGET_OS_IPHONE
#define __ios 1
#endif
......
......@@ -98,9 +98,14 @@ if(ENABLE_STATIC)
endif()
if(ENABLE_SHARED)
add_library(ortp SHARED ${ORTP_HEADER_FILES} ${ORTP_SOURCE_FILES_C} ${ORTP_SOURCE_FILES_CXX})
if(ANDROID)
set_target_properties(ortp PROPERTIES OUTPUT_NAME "ortp-${CMAKE_ANDROID_ARCH_ABI}")
else()
if(IOS)
set_target_properties(ortp PROPERTIES
FRAMEWORK TRUE
MACOSX_FRAMEWORK_IDENTIFIER com.belledonne-communications.ortp
PUBLIC_HEADER "${ORTP_HEADER_FILES}"
)
endif()
if(NOT ANDROID)
# Do not version shared library on Android
set_target_properties(ortp PROPERTIES SOVERSION ${ORTP_SO_VERSION})
endif()
......@@ -122,6 +127,7 @@ if(ENABLE_SHARED)
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
FRAMEWORK DESTINATION Frameworks
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
)
endif()
......
......@@ -687,8 +687,8 @@ void ortp_loss_rate_estimator_init(OrtpLossRateEstimator *obj, int min_packet_co
bool_t ortp_loss_rate_estimator_process_report_block(OrtpLossRateEstimator *obj, const RtpSession *session, const report_block_t *rb){
int32_t cum_loss=report_block_get_cum_packet_lost(rb);
int32_t extseq=report_block_get_high_ext_seq(rb);
int32_t diff_unique_outgoing=(int32_t)(session->stats.packet_sent-obj->last_packet_sent_count);
int32_t diff_total_outgoing=diff_unique_outgoing+(int32_t)(session->stats.packet_dup_sent-obj->last_dup_packet_sent_count);
//int32_t diff_unique_outgoing=(int32_t)(session->stats.packet_sent-obj->last_packet_sent_count);
//int32_t diff_total_outgoing=diff_unique_outgoing+(int32_t)(session->stats.packet_dup_sent-obj->last_dup_packet_sent_count);
int32_t diff;
uint64_t curtime;
bool_t got_value=FALSE;
......@@ -718,17 +718,28 @@ bool_t ortp_loss_rate_estimator_process_report_block(OrtpLossRateEstimator *obj,
}else if (diff>obj->min_packet_count_interval && curtime-obj->last_estimate_time_ms>=obj->min_time_ms_interval){
/*we have sufficient interval*/
int32_t new_losses=cum_loss-obj->last_cum_loss;
#if 0 /*SM: the following code try to takes into account sent duplicates - however by doing this it creates a bias in the loss rate computation
that can sometimes result in a negative loss rate, even if there is no duplicate.
Since the rate control doesn't use duplicates anymore, there is no good reason to take this into account.
*/
/*if we are using duplicates, they will not be visible in 'diff' variable.
But since we are the emitter, we can retrieve the total count of packet we
sent and use this value to compute the loss rate instead.*/
obj->loss_rate = 100.f * (1.f - MAX(0, (diff_unique_outgoing - new_losses) * 1.f / diff_total_outgoing));
#endif
obj->loss_rate = 100.f * (float) new_losses / (float)( extseq - obj->last_ext_seq);
/*update last values with current*/
got_value=TRUE;
obj->last_estimate_time_ms=curtime;
if (obj->loss_rate>100.f){
obj->loss_rate = 100.f;
ortp_error("ortp_loss_rate_estimator_process %p: Loss rate MUST NOT be greater than 100%%", obj);
}else if(obj->loss_rate < 0){
obj->loss_rate = 0;
ortp_error("ortp_loss_rate_estimator_process %p: Loss rate MUST NOT be negative", obj);
}
obj->last_ext_seq=extseq;
obj->last_cum_loss=cum_loss;
......
......@@ -319,7 +319,8 @@ void rtp_session_rtp_parse(RtpSession *session, mblk_t *mp, uint32_t local_str_t
ortp_warning("rtp_parse: negative timestamp jump detected");
rtp_signal_table_emit2(&session->on_timestamp_jump, &rtp->timestamp);
}
ortp_error("rtp_parse: discarding too old packet (seq_num=%i, ts=%u)",rtp->seq_number, rtp->timestamp);
ortp_error("rtp_parse: discarding too old packet (seq=%i, ts=%u, last_delivered was seq=%i, ts=%u)",rtp->seq_number, rtp->timestamp,
(int)session->rtp.rcv_last_seq, session->rtp.rcv_last_ts);
freemsg(mp);
stats->outoftime++;
ortp_global_stats.outoftime++;
......
......@@ -22,6 +22,10 @@
#define _GNU_SOURCE
#endif
#if __APPLE__
#include "TargetConditionals.h"
#endif
#ifdef HAVE_CONFIG_H
#include "ortp-config.h" /*needed for HAVE_SYS_UIO_H and HAVE_ARC4RANDOM */
#endif
......@@ -1662,7 +1666,7 @@ int rtp_session_rtp_recv (RtpSession * session, uint32_t user_ts) {
if (session->on_network_error.count>0){
rtp_signal_table_emit3(&session->on_network_error,"Error receiving RTP packet",ORTP_INT_TO_POINTER(getSocketErrorCode()));
}else ortp_warning("Error receiving RTP packet: %s, err num [%i],error [%i]",getSocketError(),errnum,error);
#ifdef __ios
#if TARGET_OS_IPHONE
/*hack for iOS and non-working socket because of background mode*/
if (errnum==ENOTCONN){
/*re-create new sockets */
......@@ -1725,7 +1729,7 @@ int rtp_session_rtcp_recv (RtpSession * session) {
if (session->on_network_error.count>0){
rtp_signal_table_emit3(&session->on_network_error,"Error receiving RTCP packet",ORTP_INT_TO_POINTER(getSocketErrorCode()));
}else ortp_warning("Error receiving RTCP packet: %s, err num [%i],error [%i]",getSocketError(),errnum,error);
#ifdef __ios
#if TARGET_OS_IPHONE
/*hack for iOS and non-working socket because of background mode*/
if (errnum==ENOTCONN){
/*re-create new sockets */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment