comparison rtsp.c @ 2684:3dd4b622f4e3 libavformat

If local port n is not available, try n + 2 instead of continuing to bind on n (allow to receive 2 rtsp streams simultaneously with libavformat)
author lucabe
date Tue, 30 Oct 2007 08:10:45 +0000
parents 6037eb4919fb
children 0ff7c5289e68
comparison
equal deleted inserted replaced
2683:153d6efc05b8 2684:3dd4b622f4e3
932 932
933 /* first try in specified port range */ 933 /* first try in specified port range */
934 if (RTSP_RTP_PORT_MIN != 0) { 934 if (RTSP_RTP_PORT_MIN != 0) {
935 while(j <= RTSP_RTP_PORT_MAX) { 935 while(j <= RTSP_RTP_PORT_MAX) {
936 snprintf(buf, sizeof(buf), "rtp://?localport=%d", j); 936 snprintf(buf, sizeof(buf), "rtp://?localport=%d", j);
937 j += 2; /* we will use two port by rtp stream (rtp and rtcp) */
937 if (url_open(&rtsp_st->rtp_handle, buf, URL_RDWR) == 0) { 938 if (url_open(&rtsp_st->rtp_handle, buf, URL_RDWR) == 0) {
938 j += 2; /* we will use two port by rtp stream (rtp and rtcp) */
939 goto rtp_opened; 939 goto rtp_opened;
940 } 940 }
941 } 941 }
942 } 942 }
943 943