[FFmpeg-devel] Reading the NTP time from RTCP timestamps

Michael Niedermayer michaelni
Fri Jun 27 15:48:55 CEST 2008

On Fri, Jun 27, 2008 at 02:04:56PM +0200, Luca Abeni wrote:
> Hi,
> while testing an RTP patch, I noticed another bug in the
> RTP demuxer:
> The NTP time is currently read from RTCP packets with
> 	s->last_rtcp_ntp_time = AV_RB64(buf + 8);
> However, such time is stored in RTCP packets as a
> 4 bytes long integer part (in seconds), followed by a
> 4 bytes long fractional part.
> So, it seems to me that a simple AV_RB64() cannot be used
> to read the NTP time (as a matter of fact, the returned
> value is wrong). I tried using
> 	s->last_rtcp_ntp_time = AV_RB32(buf + 8) * 1000000ULL + ((AV_RB32(buf + 12)  * 1000000ULL) >> 32);
> This works well (returning the NTP time in usecs), but I
> suspect it can be computed in a simpler way...
> Any ideas/suggestions?

yes the reading code looks perfectly correct, you use the wrong timebase
all over the place probably


Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I hate to see young programmers poisoned by the kind of thinking
Ulrich Drepper puts forward since it is simply too narrow -- Roman Shaposhnik
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20080627/c2c806dc/attachment.pgp>

More information about the ffmpeg-devel mailing list