[Live-devel] computing uSecondsToGo
BONNEAU Guy
gbonneau at miranda.com
Mon Apr 20 10:02:36 PDT 2009
I have had to add some fprintf messages in
MultiFramesRTPSink::sendPacketIfNecessary() to follow-up with the packet
scheduling of the live555 library. I have found that the computing of
the uSecondsToGo can become negative when a frame to be send is
segmented through many RTP packets. This happens in a call to send a
follow-up packet of a frame and fNextSendTime.tv_sec == timeNow.tv_sec
but fNextSendTime.tv_usec < timeNow.tv_usec. Fortunately the
envir().taskScheduler().scheduleDelayedTask function tests the condition
of negative delay and set it to 0. However it is somewhat confusing when
you try to debug and monitor the delay.
I suggest a cosmetic change to the function void
MultiFramedRTPSink::sendPacketIfNecessary() from:
if (fNextSendTime.tv_sec < timeNow.tv_sec) {
uSecondsToGo = 0; // prevents integer underflow if too far behind
} else {
uSecondsToGo = (fNextSendTime.tv_sec - timeNow.tv_sec)*1000000
+ (fNextSendTime.tv_usec - timeNow.tv_usec);
}
To
if ((fNextSendTime.tv_sec < timeNow.tv_sec) ||
((fNextSendTime.tv_sec == timeNow.tv_sec) && (fNextSendTime.tv_usec <
timeNow.tv_usec))) {
uSecondsToGo = 0; // prevents integer underflow if too far behind
} else {
uSecondsToGo = (fNextSendTime.tv_sec - timeNow.tv_sec)*1000000
+ (fNextSendTime.tv_usec - timeNow.tv_usec);
}
Regards
Guy Bonneau
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.live555.com/pipermail/live-devel/attachments/20090420/45fddeb9/attachment-0001.html>
More information about the live-devel
mailing list