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

Luca Abeni lucabe72
Fri Jun 27 14:04:56 CEST 2008


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?


More information about the ffmpeg-devel mailing list