From 3f3229cd109f5cdf1f1d6fe26f2864e32e029b53 Mon Sep 17 00:00:00 2001 From: Fred Rothganger Date: Tue, 11 Mar 2014 17:58:34 -0600 Subject: avformat: extracting NTP timestamp from RTCP For muxing, it accepts both 0 and AV_NOPTS_VALUE. For demuxing, it will present AV_NOPTS_VALUE when start_time_realtime is unknown. Signed-off-by: Michael Niedermayer --- libavformat/rtsp.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'libavformat/rtsp.c') diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c index d89af626da..fcf9eca0d4 100644 --- a/libavformat/rtsp.c +++ b/libavformat/rtsp.c @@ -2071,6 +2071,16 @@ redo: st2->time_base); } } + // Make real NTP start time available in AVFormatContext + if (s->start_time_realtime == AV_NOPTS_VALUE) { + s->start_time_realtime = av_rescale (rtpctx->first_rtcp_ntp_time - (NTP_OFFSET << 32), 1000000, 1LL << 32); + if (rtpctx->st) { + s->start_time_realtime -= + av_rescale (rtpctx->rtcp_ts_offset, + (uint64_t) rtpctx->st->time_base.num * 1000000, + rtpctx->st->time_base.den); + } + } } if (ret == -RTCP_BYE) { rt->nb_byes++; -- cgit v1.2.3