[FFmpeg-devel] Another nice RTP bug...

Luca Abeni lucabe72
Thu Aug 23 10:42:42 CEST 2007


Hi all,

I was trying to understand why some tools did not like the mpeg1 video 
stremed by ffmpeg, and I discovered this, in rtp_write_packet():

[...]
if (s->first_packet || rtcp_bytes >= 28) {
         /* compute NTP time */
         /* XXX: 90 kHz timestamp hardcoded */
         ntp_time = (pkt->pts << 28) / 5625;
         rtcp_send_sr(s1, ntp_time);
[...]

This looks very buggy for at least two reasons:
1) pkt->pts can be AV_NOPTS_VALUE. Well, at least it happens to be 
sometimes AV_NOPTS_VALUE, if I use "-vcodec copy".
If "pkt->pts == AV_NOPTS_VALUE" is not valid, then there is a bug 
somewhere else in libavcodec of ffmpeg.c... Let me know, and I'll search 
for it.
If "pkt->pts == AV_NOPTS_VALUE" is valid, then rtp_write_packet() has a 
bug (no surprise here ;-).

I personally think that the correct thing to do would be "ntp_time = 
av_gettime()" - RFC 3550 says "NTP timestamp: Indicates the wallclock 
time (see Section 4) when this report was sent...". What do other people 
think about it?


2) rtcp_send_sr() fills the NTP timestamp with the value of ntp_time, 
and the RTP timestamp with the value of s->timestamp. But the RFC 3550 
says "RTP timestamp: Corresponds to the same time as the NTP timestamp 
(above)...", so I think it should be computed based on ntp_time. Again, 
what's other people opinion on this?


BTW, bug 1) explains some of the strange ffserver failures I was seeing 
when streaming RTP from .mpg files...



				Thanks,
					Luca




More information about the ffmpeg-devel mailing list