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

Luca Abeni lucabe72
Fri Jun 27 17:06:09 CEST 2008


Hi Michael,

Michael Niedermayer wrote:
[...]
>> 	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

Yes, sorry; you are right (I was using a wrong timebase; not all over
the place, but in some "strategic points" :).

I got confused by the fact that
av_rescale_q(s->last_rtcp_ntp_time - s->first_rtcp_ntp_time, (AVRational){1, 2^32}, s->st->time_base);
did not work as I naively expected, and I worked around this in the
wrong way...

I am currently using
av_rescale_q(s->last_rtcp_ntp_time - s->first_rtcp_ntp_time, (AVRational){1, 1}, s->st->time_base) >> 32;
but I hope to find a better way (basically, I have to convert
from timebase 1/2^32 to s->st->time_base)


				Thanks,
					Luca




More information about the ffmpeg-devel mailing list