[Live-devel] the computation of RTP timestamp

Yutao Wei weiyutao36 at 163.com
Tue Feb 26 19:30:07 PST 2008


Hello everyone,
  
 

In live555 library, in the file RTPSink.cpp, and in the function convertToRTPTimestamp:

 

RTPSink::convertToRTPTimestamp(struct timeval tv) {
// Begin by converting from "struct timeval" units to RTP timestamp units:


(1)u_int32_t timestampIncrement = (fTimestampFrequency*tv.tv_sec);


(2)timestampIncrement += (u_int32_t)((2.0*fTimestampFrequency*tv.tv_usec + 1000000.0)/2000000);


// note: rounding

 

I found the (2) statement is some strange. In fact, it is equal to 

 

90000*(tv.tv_usec) + 0.5

 

 Can anyone tell me why it compute the timestamp this way? Why there is a 0.5?

 

Thank in advance.

 

Austin

 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.live555.com/pipermail/live-devel/attachments/20080226/74bf281d/attachment.html 


More information about the live-devel mailing list