[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Linphone-users] oRTP issue: every inbound packet 20 ms delayed?
From: |
Tobias Engel |
Subject: |
[Linphone-users] oRTP issue: every inbound packet 20 ms delayed? |
Date: |
Wed, 15 Jan 2014 14:31:36 +0000 (UTC) |
User-agent: |
Loom/3.14 (http://gmane.org/) |
Hi,
I don't know if this is the right list, but I didn't find a dedicated
oRTP mailing list, so I am trying my luck here.
I wrote a small application that uses oRTP with blocking/scheduling to
send and receive audio frames. I soon realized that for all packets I
receive through rtp_session_recv_with_ts, there was a 20ms delay between
when they were received on the socket and when they were returned to my
application. I thought I must be doing something wrong, but the included
test application "rtprecv" shows the exact same behaviour.
Below is a small patch against the current git HEAD that will output a
timestamp everytime a packet is received on the socket (after recvmsg is
called), and when it is returned to the application.
I started rtpsend/rtprecv with the following command lines:
$ ./rtprecv /dev/null 12345
and
$ ./rtpsend /dev/zero 127.0.0.1 12345
The output from rtprecv looks like this:
...
14:59:32.100639 rtp_session_recv_with_ts called
14:59:32.100664 received 172 byte message from socket
14:59:32.120794 returning 160 bytes payload
14:59:32.120844 rtp_session_recv_with_ts called
14:59:32.120869 received 172 byte message from socket
14:59:32.140008 returning 160 bytes payload
...
As you can see, there is a 20ms delay between receiving the packet and
returning it (right from the very first recevied packet).
Is there anybody who can help me with this? Maybe I am misinterpreting
something? But shouldn't the wait occur *before* the packet is received?
Many thanks in advance,
-Tobias
diff --git a/src/rtpsession.c b/src/rtpsession.c
index 79195ba..bb057f2 100644
--- a/src/rtpsession.c
+++ b/src/rtpsession.c
@@ -1247,6 +1247,12 @@ int rtp_session_recv_with_ts (RtpSession * session,
uint8_t * buffer,
mblk_t *mp=NULL;
int plen,blen=0;
*have_more=0;
+
+ struct timeval tv;
+ gettimeofday(&tv, 0);
+ struct tm tmlocal= *localtime(&tv.tv_sec);
+ fprintf(stderr, "%02d:%02d:%02d.%06d rtp_session_recv_with_ts called\n",
tmlocal.tm_hour, tmlocal.tm_min, tmlocal.tm_sec, (int)tv.tv_usec);
+
while(1){
if (session->pending){
mp=session->pending;
@@ -1276,6 +1282,11 @@ int rtp_session_recv_with_ts (RtpSession * session,
uint8_t * buffer,
}
}else break;
}
+
+ gettimeofday(&tv, 0);
+ tmlocal= *localtime(&tv.tv_sec);
+ fprintf(stderr, "%02d:%02d:%02d.%06d returning %d bytes payload\n",
tmlocal.tm_hour, tmlocal.tm_min, tmlocal.tm_sec, (int)tv.tv_usec, blen);
+
return blen;
}
/**
diff --git a/src/rtpsession_inet.c b/src/rtpsession_inet.c
index 1dffe5e..0649b9a 100644
--- a/src/rtpsession_inet.c
+++ b/src/rtpsession_inet.c
@@ -1149,6 +1149,14 @@ int rtp_session_rtp_recv_abstract(ortp_socket_t
socket, mblk_t *msg, int flags,
if(fromlen != NULL)
*fromlen = msghdr.msg_namelen;
if(ret >= 0) {
+
+ if(ret > 0) {
+ struct timeval tv;
+ gettimeofday(&tv, 0);
+ struct tm tmlocal= *localtime(&tv.tv_sec);
+ fprintf(stderr, "%02d:%02d:%02d.%06d received %d byte
message from
socket\n", tmlocal.tm_hour, tmlocal.tm_min, tmlocal.tm_sec, (int)tv.tv_usec,
ret);
+ }
+
#else
char control[512];
WSAMSG msghdr;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Linphone-users] oRTP issue: every inbound packet 20 ms delayed?,
Tobias Engel <=