Ticket #916: ffmpeg_fix_rtp_udp_port_issue.patch

File ffmpeg_fix_rtp_udp_port_issue.patch, 1.4 KB (added by Dmitry Volyntsev, 14 years ago)

proposed patch

  • libavformat/rtsp.c

    diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
    index d32f49e..bf2be6a 100644
    a b int ff_rtsp_make_setup_request(AVFormatContext *s, const char *host, i  
    11571157                goto have_port;
    11581158            }
    11591159
    1160             /* first try in specified port range */
    1161             if (RTSP_RTP_PORT_MIN != 0) {
    1162                 while (j <= RTSP_RTP_PORT_MAX) {
    1163                     ff_url_join(buf, sizeof(buf), "rtp", NULL, host, -1,
    1164                                 "?localport=%d", j);
    1165                     /* we will use two ports per rtp stream (rtp and rtcp) */
    1166                     j += 2;
    1167                     if (ffurl_open(&rtsp_st->rtp_handle, buf, AVIO_FLAG_READ_WRITE,
    1168                                    &s->interrupt_callback, NULL) == 0)
    1169                         goto rtp_opened;
    1170                 }
    1171             }
     1160            /* OS will choose local port by itself */
     1161            ff_url_join(buf, sizeof(buf), "rtp", NULL, host, -1,
     1162                       "?localport=%d", 0);
     1163            /* we will use two ports per rtp stream (rtp and rtcp) */
     1164            j += 2;
     1165            if (ffurl_open(&rtsp_st->rtp_handle, buf, AVIO_FLAG_READ_WRITE,
     1166                       &s->interrupt_callback, NULL) == 0)
     1167               goto rtp_opened;
    11721168
    11731169            av_log(s, AV_LOG_ERROR, "Unable to open an input RTP port\n");
    11741170            err = AVERROR(EIO);