*** empty log message ***

This commit is contained in:
Thomas Ries 2007-05-27 18:26:38 +00:00
parent 8c27d38ee3
commit 2448fa5785
2 changed files with 32 additions and 24 deletions

View File

@ -31,11 +31,11 @@ typedef struct {
struct timeval dejitter_tv ; struct timeval dejitter_tv ;
double dejitter_d ; double dejitter_d ;
int time_code_a ; int time_code_a ;
double recived_a ; /* time in µsec sience epoch */ double received_a ; /* time in µsec sience epoch */
int time_code_b ; int time_code_b ;
double recived_b ; /* time in µsec sience epoch */ double received_b ; /* time in µsec sience epoch */
int time_code_c ; int time_code_c ;
double recived_c ; /* time in µsec sience epoch */ double received_c ; /* time in µsec sience epoch */
} timecontrol_t ; } timecontrol_t ;

View File

@ -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 */ /* I hate this computer language ... :-/ quite confuse ! look modula */
packet_time_code = fetch_missalign_long_network_oder(&((*rtp_buff)[4])); 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) { if (tc->calccount == 0) {
DEBUGC(DBCLASS_RTP, "initialise time calculatin"); DEBUGC(DBCLASS_RTP, "initialise time calculatin");
tc->starttime = *input_tv; 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); calculatedtime = currenttime = make_double_time(&input_r_tv);
if (tc->calccount < 10) { if (tc->calccount < 10) {
DEBUGC(DBCLASS_RTP, "initial data stage 1 %f usec", currenttime); 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) { } 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); (packet_time_code - tc->time_code_a);
} else { } 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); (packet_time_code - tc->time_code_a);
} }
if (tc->calccount > 20) { if (tc->calccount > 20) {
if (!tc->time_code_b) { if (!tc->time_code_b) {
tc->time_code_b = packet_time_code; tc->time_code_b = packet_time_code;
tc->recived_b = currenttime; tc->received_b = currenttime;
} else if (tc->time_code_b < packet_time_code) { } else if (tc->time_code_b < packet_time_code) {
calculatedtime = tc->recived_b = tc->recived_b + calculatedtime = tc->received_b = tc->received_b +
(packet_time_code - tc->time_code_b) * tc->recived_a; (packet_time_code - tc->time_code_b) * tc->received_a;
tc->time_code_b = packet_time_code; tc->time_code_b = packet_time_code;
if (tc->calccount < 28) { 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) { } 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 { } else {
tc->recived_b = 0.99 * tc->recived_b + 0.01 * currenttime; tc->received_b = 0.99 * tc->received_b + 0.01 * currenttime;
} }
} else { } else {
calculatedtime = tc->recived_b + calculatedtime = tc->received_b +
(packet_time_code - tc->time_code_b) * tc->recived_a; (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; tc->time_code_c = packet_time_code;
if (tc->calccount < 30) { 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 ** theoretical value for F1000 Phone
*/ */
//calculatedtime = (tc->recived_a = 125.) * packet_time_code; //calculatedtime = (tc->received_a = 125.) * packet_time_code;
tc->calccount ++; tc->calccount ++;
calculatedtime += tc->dejitter_d; 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", DEBUGC(DBCLASS_RTPBABL, "timecodes %i, %i, %i",
tc->time_code_a, tc->time_code_b, tc->time_code_c); tc->time_code_a, tc->time_code_b, tc->time_code_c);
DEBUGC(DBCLASS_RTPBABL, "measuredtimes %f usec, %f usec, %f usec", 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)", DEBUGC(DBCLASS_RTPBABL, "p2 - p1 = (%i,%f usec)",
tc->time_code_b - tc->time_code_a, 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) { if (tc->time_code_c) {
DEBUGC(DBCLASS_RTPBABL, "p3 - p2 = (%i,%f usec)", DEBUGC(DBCLASS_RTPBABL, "p3 - p2 = (%i,%f usec)",
tc->time_code_c - tc->time_code_b, 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); DEBUGC(DBCLASS_RTPBABL, "calculatedtime = %f", calculatedtime);
if (calculatedtime2) { if (calculatedtime2) {
DEBUGC(DBCLASS_RTPBABL, "calculatedtime2 = %f", calculatedtime2); DEBUGC(DBCLASS_RTPBABL, "calculatedtime2 = %f", calculatedtime2);
} }
DEBUGC(DBCLASS_RTPBABL, "transmtime = %f (%f)", calculatedtime / DEBUGC(DBCLASS_RTPBABL, "transmtime = %f (%f)", calculatedtime /
(160. * tc->recived_a) - packet_time_code / 160, (160. * tc->received_a) - packet_time_code / 160,
currenttime / (160. * tc->recived_a) - currenttime / (160. * tc->received_a) -
packet_time_code / 160); packet_time_code / 160);
DEBUGC(DBCLASS_RTPBABL, "synthetic latency = %f, %f, %f, %i, %i", DEBUGC(DBCLASS_RTPBABL, "synthetic latency = %f, %f, %f, %i, %i",
calculatedtime-currenttime, calculatedtime, 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 */ /* some other error that I probably want to know about */
int j; int j;
WARN("read() [fd=%i, %s:%i] returned error [%i:%s]", WARN("read() [fd=%i, %s:%i] returned error [%i:%s]",
rtp_proxytable[rtp_proxytable_idx].rtp_rx_sock, socket_type ? rtp_proxytable[rtp_proxytable_idx].rtp_rx_sock :
utils_inet_ntoa(rtp_proxytable[rtp_proxytable_idx].local_ipaddr), rtp_proxytable[rtp_proxytable_idx].rtp_con_rx_sock,
rtp_proxytable[rtp_proxytable_idx].local_port, errno, strerror(errno)); 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<RTPPROXY_SIZE;j++) { for (j=0; j<RTPPROXY_SIZE;j++) {
DEBUGC(DBCLASS_RTP, "%i - rx:%i tx:%i %s@%s dir:%i " DEBUGC(DBCLASS_RTP, "%i - rx:%i tx:%i %s@%s dir:%i "
"lp:%i, rp:%i rip:%s", "lp:%i, rp:%i rip:%s",