[Live-devel] Frames from the future - or maybe not

sampsa sampsa.riikonen at dasys.fi
Fri Dec 9 13:55:27 PST 2016


Hi,

I am looking at frame/slice timestamps from several rtsp cameras (most 
of them chinese brands) and have this strange problem ..

.. the timestamps refer to future, when comparing them to the frame's 
arrival time to the client machine (typically in the order of tens of 
milliseconds).

i.e. I am comparing the system time at slice arrival to the timestamp 
included in the slice.

One way to confirm this, is to modify the good old testRTSPClient.cpp: 
void DummySink::afterGettingFrame along these lines:

------------
...
char uSecsStr[30+1];
struct timeval systime;
double systimefloat;
double frametimefloat;

gettimeofday(&systime, NULL);

sprintf(uSecsStr, 
"%u.%06u",(unsigned)systime.tv_sec,(unsigned)systime.tv_usec);
systimefloat=strtod(uSecsStr,NULL);

sprintf(uSecsStr, "%u.%06u", 
(unsigned)presentationTime.tv_sec,(unsigned)presentationTime.tv_usec);
frametimefloat=strtod(uSecsStr,NULL);

envir() << systimefloat-frametimefloat << " ";

if (fSubsession.rtpSource() != NULL && 
!fSubsession.rtpSource()->hasBeenSynchronizedUsingRTCP()) {
   envir() << " !"; // mark the debugging output to indicate that this 
presentation time is not RTCP-synchronized
}
...
-----------

I would expect the time-of-arrival of the frame-slice to my client being 
greater than the timestamp in the slice (that is supposedly generated in 
the rtsp camera)- i.e., frames arrive after they have been generated, 
uh.. right?  But I get lots of this kind of output:

0.014241  !
-0.004223  !
0.012092  !
0.013395  !
-0.003483  !
0.020684  !
-0.021564  !
0.002708  !

So, there are three options here:

1) The chinese camera manufacturers have created a camera that grabs 
video from the future
2) The camera generates faulty timestamps.  If so, is this a common 
problem with rtsp cameras?
3) live555 has to do some guessing (based on the bitrate?) of the 
timestamps, as there seems to be no rtcp sync and that might go wrong
4) I made a mistake here / have not understood something fundamental

Help appreciated to solve this mystery.

Regards,

Sampsa



More information about the live-devel mailing list