From 2448fa5785afdb16e5fc6abf57da53bd35e2d714 Mon Sep 17 00:00:00 2001 From: Thomas Ries Date: Sun, 27 May 2007 18:26:38 +0000 Subject: [PATCH] *** empty log message *** --- src/rtpproxy.h | 6 +++--- src/rtpproxy_relay.c | 50 +++++++++++++++++++++++++------------------- 2 files changed, 32 insertions(+), 24 deletions(-) diff --git a/src/rtpproxy.h b/src/rtpproxy.h index 7cd70fd..b56be7c 100644 --- a/src/rtpproxy.h +++ b/src/rtpproxy.h @@ -31,11 +31,11 @@ typedef struct { struct timeval dejitter_tv ; double dejitter_d ; int time_code_a ; - double recived_a ; /* time in µsec sience epoch */ + double received_a ; /* time in µsec sience epoch */ int time_code_b ; - double recived_b ; /* time in µsec sience epoch */ + double received_b ; /* time in µsec sience epoch */ int time_code_c ; - double recived_c ; /* time in µsec sience epoch */ + double received_c ; /* time in µsec sience epoch */ } timecontrol_t ; diff --git a/src/rtpproxy_relay.c b/src/rtpproxy_relay.c index 4de9981..fae8196 100644 --- a/src/rtpproxy_relay.c +++ b/src/rtpproxy_relay.c @@ -1235,6 +1235,12 @@ static void calculate_transmit_time(rtp_buff_t *rtp_buff, timecontrol_t *tc, /* I hate this computer language ... :-/ quite confuse ! look modula */ packet_time_code = fetch_missalign_long_network_oder(&((*rtp_buff)[4])); +/*&&&& beware, it seems that when sending RTP events (payload type +telephone-event) the timestamp does not increment and stays the same. +The sequence number however DOES increment. This could lead to confusion when +transmitting RTP events (like DTMF). How can we handle this? Check for RTP event +and then do an "educated guess" for the to-be timestamp? +*/ if (tc->calccount == 0) { DEBUGC(DBCLASS_RTP, "initialise time calculatin"); tc->starttime = *input_tv; @@ -1246,35 +1252,35 @@ static void calculate_transmit_time(rtp_buff_t *rtp_buff, timecontrol_t *tc, calculatedtime = currenttime = make_double_time(&input_r_tv); if (tc->calccount < 10) { DEBUGC(DBCLASS_RTP, "initial data stage 1 %f usec", currenttime); - tc->recived_a = currenttime / (packet_time_code - tc->time_code_a); + tc->received_a = currenttime / (packet_time_code - tc->time_code_a); } else if (tc->calccount < 20) { - tc->recived_a = 0.95 * tc->recived_a + 0.05 * currenttime / + tc->received_a = 0.95 * tc->received_a + 0.05 * currenttime / (packet_time_code - tc->time_code_a); } else { - tc->recived_a = 0.99 * tc->recived_a + 0.01 * currenttime / + tc->received_a = 0.99 * tc->received_a + 0.01 * currenttime / (packet_time_code - tc->time_code_a); } if (tc->calccount > 20) { if (!tc->time_code_b) { tc->time_code_b = packet_time_code; - tc->recived_b = currenttime; + tc->received_b = currenttime; } else if (tc->time_code_b < packet_time_code) { - calculatedtime = tc->recived_b = tc->recived_b + - (packet_time_code - tc->time_code_b) * tc->recived_a; + calculatedtime = tc->received_b = tc->received_b + + (packet_time_code - tc->time_code_b) * tc->received_a; tc->time_code_b = packet_time_code; if (tc->calccount < 28) { - tc->recived_b = 0.90 * tc->recived_b + 0.1 * currenttime; + tc->received_b = 0.90 * tc->received_b + 0.1 * currenttime; } else if (tc->calccount < 300) { - tc->recived_b = 0.95 * tc->recived_b + 0.05 * currenttime; + tc->received_b = 0.95 * tc->received_b + 0.05 * currenttime; } else { - tc->recived_b = 0.99 * tc->recived_b + 0.01 * currenttime; + tc->received_b = 0.99 * tc->received_b + 0.01 * currenttime; } } else { - calculatedtime = tc->recived_b + - (packet_time_code - tc->time_code_b) * tc->recived_a; + calculatedtime = tc->received_b + + (packet_time_code - tc->time_code_b) * tc->received_a; } } - tc->recived_c = currenttime; + tc->received_c = currenttime; tc->time_code_c = packet_time_code; if (tc->calccount < 30) { @@ -1288,7 +1294,7 @@ static void calculate_transmit_time(rtp_buff_t *rtp_buff, timecontrol_t *tc, /* ** theoretical value for F1000 Phone */ - //calculatedtime = (tc->recived_a = 125.) * packet_time_code; + //calculatedtime = (tc->received_a = 125.) * packet_time_code; tc->calccount ++; calculatedtime += tc->dejitter_d; @@ -1306,22 +1312,22 @@ static void calculate_transmit_time(rtp_buff_t *rtp_buff, timecontrol_t *tc, DEBUGC(DBCLASS_RTPBABL, "timecodes %i, %i, %i", tc->time_code_a, tc->time_code_b, tc->time_code_c); DEBUGC(DBCLASS_RTPBABL, "measuredtimes %f usec, %f usec, %f usec", - tc->recived_a, tc->recived_b, tc->recived_c); + tc->received_a, tc->received_b, tc->received_c); DEBUGC(DBCLASS_RTPBABL, "p2 - p1 = (%i,%f usec)", tc->time_code_b - tc->time_code_a, - tc->recived_b - tc->recived_a); + tc->received_b - tc->received_a); if (tc->time_code_c) { DEBUGC(DBCLASS_RTPBABL, "p3 - p2 = (%i,%f usec)", tc->time_code_c - tc->time_code_b, - tc->recived_c - tc->recived_b); + tc->received_c - tc->received_b); } DEBUGC(DBCLASS_RTPBABL, "calculatedtime = %f", calculatedtime); if (calculatedtime2) { DEBUGC(DBCLASS_RTPBABL, "calculatedtime2 = %f", calculatedtime2); } DEBUGC(DBCLASS_RTPBABL, "transmtime = %f (%f)", calculatedtime / - (160. * tc->recived_a) - packet_time_code / 160, - currenttime / (160. * tc->recived_a) - + (160. * tc->received_a) - packet_time_code / 160, + currenttime / (160. * tc->received_a) - packet_time_code / 160); DEBUGC(DBCLASS_RTPBABL, "synthetic latency = %f, %f, %f, %i, %i", calculatedtime-currenttime, calculatedtime, @@ -1419,9 +1425,11 @@ static void error_handler (int rtp_proxytable_idx, int socket_type) { /* some other error that I probably want to know about */ int j; WARN("read() [fd=%i, %s:%i] returned error [%i:%s]", - rtp_proxytable[rtp_proxytable_idx].rtp_rx_sock, - utils_inet_ntoa(rtp_proxytable[rtp_proxytable_idx].local_ipaddr), - rtp_proxytable[rtp_proxytable_idx].local_port, errno, strerror(errno)); + socket_type ? rtp_proxytable[rtp_proxytable_idx].rtp_rx_sock : + rtp_proxytable[rtp_proxytable_idx].rtp_con_rx_sock, + utils_inet_ntoa(rtp_proxytable[rtp_proxytable_idx].local_ipaddr), + rtp_proxytable[rtp_proxytable_idx].local_port + socket_type, + errno, strerror(errno)); for (j=0; j