If local port n is not available, try n + 2 instead of continuing to bind
authorLuca Abeni <lucabe72@email.it>
Tue, 30 Oct 2007 08:10:45 +0000 (08:10 +0000)
committerLuca Abeni <lucabe72@email.it>
Tue, 30 Oct 2007 08:10:45 +0000 (08:10 +0000)
on n (allow to receive 2 rtsp streams simultaneously with libavformat)

Originally committed as revision 10876 to svn://svn.ffmpeg.org/ffmpeg/trunk

libavformat/rtsp.c

index 9ef7f1f80e33e3d1c41ecae8ba94f48d876ea34c..0857c5d548892575aa253d5553dd408f19eb5eee 100644 (file)
@@ -934,8 +934,8 @@ static int rtsp_read_header(AVFormatContext *s,
             if (RTSP_RTP_PORT_MIN != 0) {
                 while(j <= RTSP_RTP_PORT_MAX) {
                     snprintf(buf, sizeof(buf), "rtp://?localport=%d", j);
+                    j += 2; /* we will use two port by rtp stream (rtp and rtcp) */
                     if (url_open(&rtsp_st->rtp_handle, buf, URL_RDWR) == 0) {
-                        j += 2; /* we will use two port by rtp stream (rtp and rtcp) */
                         goto rtp_opened;
                     }
                 }