[FFmpeg-devel] [PATCH] log first rtsp ntp time

Daniel Oberhoff danieloberhoff at gmail.com
Fri Mar 18 09:41:23 CET 2016


This enables extracting the source wall clock time from the rtsp stream, which is extremely useful for synchronization with other sources.

diff --git a/libavformat/rtpdec.c b/libavformat/rtpdec.c
index c8eed7e..e6b353a 100644
--- a/libavformat/rtpdec.c
+++ b/libavformat/rtpdec.c
@@ -22,6 +22,7 @@
 #include "libavutil/mathematics.h"
 #include "libavutil/avstring.h"
 #include "libavutil/time.h"
+#include "libavutil/log.h"
 #include "libavcodec/get_bits.h"
 #include "avformat.h"
 #include "network.h"
@@ -159,6 +160,7 @@ static int rtcp_parse_packet(RTPDemuxContext *s, const unsigned char *buf,
             s->last_rtcp_timestamp = AV_RB32(buf + 16);
             if (s->first_rtcp_ntp_time == AV_NOPTS_VALUE) {
                 s->first_rtcp_ntp_time = s->last_rtcp_ntp_time;
+                av_log(s, AV_LOG_INFO, "rtp got first timestamp %li", s->first_rtcp_ntp_time);
                 if (!s->base_timestamp)
                     s->base_timestamp = s->last_rtcp_timestamp;
                 s->rtcp_ts_offset = (int32_t)(s->last_rtcp_timestamp - s->base_timestamp);



More information about the ffmpeg-devel mailing list