diff options
author | Luca Abeni <lucabe72@email.it> | 2008-02-20 10:19:35 +0000 |
---|---|---|
committer | Luca Abeni <lucabe72@email.it> | 2008-02-20 10:19:35 +0000 |
commit | d597e1b76cbde5d8ae04dfa4207f5813b3dbf8af (patch) | |
tree | 96bcd19c928ad1980b2d41e8b37a76d54eb5f90f /libavformat | |
parent | 91acf9a8bcd2372b34657ff4364c26ee876044fd (diff) | |
download | ffmpeg-d597e1b76cbde5d8ae04dfa4207f5813b3dbf8af.tar.gz |
Fix computation of the "NTP time" field in RTCP SR packets, and do not
export times with microsecond precision
Originally committed as revision 12158 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/rtpenc.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/libavformat/rtpenc.c b/libavformat/rtpenc.c index 9e62c6571f..19e4f19fe4 100644 --- a/libavformat/rtpenc.c +++ b/libavformat/rtpenc.c @@ -33,6 +33,13 @@ //#define DEBUG #define RTCP_SR_SIZE 28 +#define NTP_OFFSET 2208988800ULL +#define NTP_OFFSET_US (NTP_OFFSET * 1000000ULL) + +static uint64_t ntp_time(void) +{ + return (av_gettime() / 1000) * 1000 + NTP_OFFSET_US; +} static int rtp_write_header(AVFormatContext *s1) { @@ -301,8 +308,8 @@ static int rtp_write_packet(AVFormatContext *s1, AVPacket *pkt) rtcp_bytes = ((s->octet_count - s->last_octet_count) * RTCP_TX_RATIO_NUM) / RTCP_TX_RATIO_DEN; if (s->first_packet || ((rtcp_bytes >= RTCP_SR_SIZE) && - (av_gettime() - s->last_rtcp_ntp_time > 5000000))) { - rtcp_send_sr(s1, av_gettime()); + (ntp_time() - s->last_rtcp_ntp_time > 5000000))) { + rtcp_send_sr(s1, ntp_time()); s->last_octet_count = s->octet_count; s->first_packet = 0; } |