<html><head><meta http-equiv="Content-Type" content="text/html charset=iso-8859-1"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><blockquote type="cite"><div><div><font face="Arial"><div><font size="2" face="Arial"><span class="580024614-05112012">we want to use 
live555 in one of our products on the WinCE platform and we have some 
issues with timestamp calculation.</span></font></div>
<div><font size="2" face="Arial"><span class="580024614-05112012">From file 
liveMedia/RTPSink.cpp:</span></font></div>
<div><span class="580024614-05112012"><p><font size="2" face="Courier New">u_int32_t 
RTPSink::convertToRTPTimestamp(<font color="#0000ff"><font color="#0000ff">struct</font></font> timeval tv) {</font></p><p><font color="#008000"><font color="#008000"><font size="2" face="Courier New">// 
Begin by converting from "struct timeval" units to RTP timestamp 
units:</font></font></font></p><p><font size="2" face="Courier New">u_int32_t timestampIncrement = 
(fTimestampFrequency*tv.tv_sec);</font></p><p><font size="2" face="Courier New"><u>timestampIncrement += 
(u_int32_t)((2.0*fTimestampFrequency*tv.tv_usec + 
1000000.0)/2000000);</u></font></p><p><font color="#008000"><font color="#008000" size="2" face="Courier New">// note: 
rounding</font></font></p><p><span class="580024614-05112012"><font color="#008000" size="2">...</font></span></p></span></div>
<div><font size="2"><span class="580024614-05112012">Could you tell me why you are 
calculation the timstampIncrement like this?</span></font></div></font></div></div></blockquote><div><br></div>It's done this way so that the result is rounded to the nearest integer.  Suppose, for example, that "fTimestampFrequency*tv.tv_usec" is 1990000.  Computing "tv.tv_usec*fTimestampFrequency/1000000.0" will give you 1 (when converted back to an "int").  However, computing "(2.0*fTimestampFrequency*tv.tv_usec + 1000000.0)/2000000" will give you 2, which is more accurate.</div><div><br></div><div>What specific 'issues' do you think you are having with timestamp calculation?  Are you having a problem specifically with this line of code??  If not, then your 'issues' are probably not with timestamp calculation.  Note that developers usually don't need to concern themselves with RTP timestamps; our software automatically converts presentation times to RTP timestamps (on transmission), and then back to presentation times (on reception).  As a developer, the important thing that you need to concern yourself with is ***presentation times***.  Your data sources' frames *must* have accurate presentation times, and they must be aligned to 'wall clock' time (i.e., the time that you would get by calling "gettimeofday()".)</div><br><br><div apple-content-edited="true">
<span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; ">Ross Finlayson<br>Live Networks, Inc.<br><a href="http://www.live555.com/">http://www.live555.com/</a></span></span>
</div>
<br></body></html>