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

 

 

 

_______________________________________________
live-devel mailing list
live-devel@lists.live555.com
http://lists.live555.com/mailman/listinfo/live-devel

Reply via email to