diff options
author | Martin Storsjö <martin@martin.st> | 2011-01-01 22:27:16 +0000 |
---|---|---|
committer | Martin Storsjö <martin@martin.st> | 2011-01-01 22:27:16 +0000 |
commit | 3a1cdcc798fd7cb60ef69d1d010f5d56218c4b3a (patch) | |
tree | a07de61f687827dc5a3bd9b70cae18e6eefb77f0 /libavformat/rtsp.c | |
parent | dfaa9f3cb328f245cc1f9c56145a21c6d6e58f42 (diff) | |
download | ffmpeg-3a1cdcc798fd7cb60ef69d1d010f5d56218c4b3a.tar.gz |
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
Diffstat (limited to 'libavformat/rtsp.c')
-rw-r--r-- | libavformat/rtsp.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c index 8c9d79cd8f..ca84e5df2b 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) { |