From 3a1cdcc798fd7cb60ef69d1d010f5d56218c4b3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Sat, 1 Jan 2011 22:27:16 +0000 Subject: rtpdec: Emit timestamps for packets before the first RTCP packet, too Emitted timestamps in each stream start from 0, for the first received RTP packet. Once an RTCP packet is received, that one is used for sync, emitting timestamps that fit seamlessly into the earlier ones. Originally committed as revision 26187 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavformat/rtsp.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'libavformat/rtsp.c') diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c index 8c9d79c..ca84e5d 100644 --- a/libavformat/rtsp.c +++ b/libavformat/rtsp.c @@ -1617,11 +1617,21 @@ int ff_rtsp_fetch_packet(AVFormatContext *s, AVPacket *pkt) * in order to map their timestamp origin to the same ntp time * as this one. */ int i; + AVStream *st = NULL; + if (rtsp_st->stream_index >= 0) + st = s->streams[rtsp_st->stream_index]; for (i = 0; i < rt->nb_rtsp_streams; i++) { RTPDemuxContext *rtpctx2 = rt->rtsp_streams[i]->transport_priv; - if (rtpctx2 && - rtpctx2->first_rtcp_ntp_time == AV_NOPTS_VALUE) + AVStream *st2 = NULL; + if (rt->rtsp_streams[i]->stream_index >= 0) + st2 = s->streams[rt->rtsp_streams[i]->stream_index]; + if (rtpctx2 && st && st2 && + rtpctx2->first_rtcp_ntp_time == AV_NOPTS_VALUE) { rtpctx2->first_rtcp_ntp_time = rtpctx->first_rtcp_ntp_time; + rtpctx2->rtcp_ts_offset = av_rescale_q( + rtpctx->rtcp_ts_offset, st->time_base, + st2->time_base); + } } } if (ret == -RTCP_BYE) { -- cgit v1.1