[Live-devel] Timestamp conversion in RTPSink.cpp

Roehrl, Simon simon.roehrl.ext at siemens.com
Mon Nov 5 07:34:52 PST 2012


Hi,

we want to use live555 in one of our products on the WinCE platform and we have some issues with timestamp calculation.
>From file liveMedia/RTPSink.cpp:

u_int32_t RTPSink::convertToRTPTimestamp(struct timeval tv) {

// Begin by converting from "struct timeval" units to RTP timestamp units:

u_int32_t timestampIncrement = (fTimestampFrequency*tv.tv_sec);

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

// note: rounding

...

Could you tell me why you are calculation the timstampIncrement like this? Is there a reason for adding '1000000.0'?
This doesn't make sense to me.

I would suggest:

timestampIncrement += (tv.tv_usec*fTimestampFrequency/1000000.0);

Kind Regards,

Simon Röhrl
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.live555.com/pipermail/live-devel/attachments/20121105/1b5244bc/attachment.html>


More information about the live-devel mailing list