[FFmpeg-devel] [PATCH] rtsp: Properly fail if unable to open an input RTP port

Martin Storsjö martin
Sun Jan 9 11:49:46 CET 2011


On Thu, 6 Jan 2011, Martin Storsj? wrote:

> @@ -1075,26 +1075,28 @@ static int make_setup_request(AVFormatContext *s, const char *host, int port,
>                  goto have_port;
>              }
>  
>              /* first try in specified port range */
>              if (RTSP_RTP_PORT_MIN != 0) {
>                  while (j <= RTSP_RTP_PORT_MAX) {
>                      ff_url_join(buf, sizeof(buf), "rtp", NULL, host, -1,
>                                  "?localport=%d", j);
>                      /* we will use two ports per rtp stream (rtp and rtcp) */
>                      j += 2;
>                      if (url_open(&rtsp_st->rtp_handle, buf, URL_RDWR) == 0)
>                          goto rtp_opened;
>                  }
> +                err = AVERROR(EIO);
> +                goto fail;
>              }
>  
>  #if 0
>              /* then try on any port */
>              if (url_open(&rtsp_st->rtp_handle, "rtp://", URL_RDONLY) < 0) {
>                  err = AVERROR_INVALIDDATA;
>                  goto fail;
>              }
>  #endif
>  
>          rtp_opened:
>              port = rtp_get_local_rtp_port(rtsp_st->rtp_handle);
>          have_port:
> -- 

Acked by Luca B on irc, applied a slightly modified version, fitting in 
better with the #if 0 block.

// Martin



More information about the ffmpeg-devel mailing list