diff options
author | Martin Storsjö <martin@martin.st> | 2010-04-20 07:34:28 +0000 |
---|---|---|
committer | Martin Storsjö <martin@martin.st> | 2010-04-20 07:34:28 +0000 |
commit | 2cab6b48ad9595abe24615c3262f22b76c9b921d (patch) | |
tree | cee1cf9ffde9beb4989a76f5b3615c59c57aed55 /libavformat/rtsp.c | |
parent | 2293a2e67fb54aae165bb042d3154a7809a81860 (diff) | |
download | ffmpeg-2cab6b48ad9595abe24615c3262f22b76c9b921d.tar.gz |
Revert svn rev 21857, readd first_rtcp_ntp_time in RTPDemuxContext
In order to sync RTP streams that get their initial RTCP timestamp at
different times, propagate the NTP timestamp of the first RTCP packet
to all other streams.
This makes the timestamps of returned packets start at (near) zero instead
of at any random offset.
Originally committed as revision 22917 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/rtsp.c')
-rw-r--r-- | libavformat/rtsp.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c index b0fa2eae25..0931201f81 100644 --- a/libavformat/rtsp.c +++ b/libavformat/rtsp.c @@ -1796,8 +1796,27 @@ static int rtsp_fetch_packet(AVFormatContext *s, AVPacket *pkt) return AVERROR_EOF; if (rt->transport == RTSP_TRANSPORT_RDT) { ret = ff_rdt_parse_packet(rtsp_st->transport_priv, pkt, buf, len); - } else + } else { ret = rtp_parse_packet(rtsp_st->transport_priv, pkt, buf, len); + if (ret < 0) { + /* Either bad packet, or a RTCP packet. Check if the + * first_rtcp_ntp_time field was initialized. */ + RTPDemuxContext *rtpctx = rtsp_st->transport_priv; + if (rtpctx->first_rtcp_ntp_time != AV_NOPTS_VALUE) { + /* first_rtcp_ntp_time has been initialized for this stream, + * copy the same value to all other uninitialized streams, + * in order to map their timestamp origin to the same ntp time + * as this one. */ + int i; + for (i = 0; i < rt->nb_rtsp_streams; i++) { + RTPDemuxContext *rtpctx2 = rtsp_st->transport_priv; + if (rtpctx2 && + rtpctx2->first_rtcp_ntp_time == AV_NOPTS_VALUE) + rtpctx2->first_rtcp_ntp_time = rtpctx->first_rtcp_ntp_time; + } + } + } + } if (ret < 0) goto redo; if (ret == 1) |