diff options
author | Josh Allmann <joshua.allmann@gmail.com> | 2010-08-29 10:25:16 +0000 |
---|---|---|
committer | Martin Storsjö <martin@martin.st> | 2010-08-29 10:25:16 +0000 |
commit | b20359f51a1c3be5603be9908061b27f883f9467 (patch) | |
tree | da33f81dcf80d66304bda521c18494945ee12b0b /libavformat/rtsp.c | |
parent | 682d28a965c859a8826c1b52c3437a6a0c4ab59f (diff) | |
download | ffmpeg-b20359f51a1c3be5603be9908061b27f883f9467.tar.gz |
rtsp: Return AVERROR_EOF when all streams have received an RTCP BYE packet
Patch by Josh Allmann, joshua dot allmann at gmail
Originally committed as revision 24965 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/rtsp.c')
-rw-r--r-- | libavformat/rtsp.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c index 16997e3245..c3f4d00858 100644 --- a/libavformat/rtsp.c +++ b/libavformat/rtsp.c @@ -1226,6 +1226,7 @@ static int rtsp_read_play(AVFormatContext *s) char cmd[1024]; av_log(s, AV_LOG_DEBUG, "hello state=%d\n", rt->state); + rt->nb_byes = 0; if (!(rt->server_type == RTSP_SERVER_REAL && rt->need_subscription)) { if (rt->state == RTSP_STATE_PAUSED) { @@ -1777,6 +1778,9 @@ static int rtsp_fetch_packet(AVFormatContext *s, AVPacket *pkt) uint8_t buf[10 * RTP_MAX_PACKET_LENGTH]; RTSPStream *rtsp_st; + if (rt->nb_byes == rt->nb_rtsp_streams) + return AVERROR_EOF; + /* get next frames from the same RTP packet */ if (rt->cur_transport_priv) { if (rt->transport == RTSP_TRANSPORT_RDT) { @@ -1833,6 +1837,15 @@ static int rtsp_fetch_packet(AVFormatContext *s, AVPacket *pkt) rtpctx2->first_rtcp_ntp_time = rtpctx->first_rtcp_ntp_time; } } + if (ret == -RTCP_BYE) { + rt->nb_byes++; + + av_log(s, AV_LOG_DEBUG, "Received BYE for stream %d (%d/%d)\n", + rtsp_st->stream_index, rt->nb_byes, rt->nb_rtsp_streams); + + if (rt->nb_byes == rt->nb_rtsp_streams) + return AVERROR_EOF; + } } } if (ret < 0) |