Mercurial > libavformat.hg
diff rtsp.c @ 6423:2685bf2b0b78 libavformat
rtsp: Return AVERROR_EOF when all streams have received an RTCP BYE packet
Patch by Josh Allmann, joshua dot allmann at gmail
author | mstorsjo |
---|---|
date | Sun, 29 Aug 2010 10:25:16 +0000 |
parents | e3eb93b5a119 |
children | 3f50c7effad1 |
line wrap: on
line diff
--- a/rtsp.c Sun Aug 29 10:20:18 2010 +0000 +++ b/rtsp.c Sun Aug 29 10:25:16 2010 +0000 @@ -1226,6 +1226,7 @@ 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 @@ 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 @@ 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)