[FFmpeg-devel] [PATCH] rtsp: Properly fail if unable to open an input RTP port
Martin Storsjö
martin
Thu Jan 6 20:12:53 CET 2011
---
Updated patch with more context lines, to make it easier to see directly
from the patch what it does. Is it ok to keep this code here, or should it
be moved down below the #if 0 block, above the rtp_opened label?
libavformat/rtsp.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
index b09ebd7..4e0d092 100644
--- a/libavformat/rtsp.c
+++ b/libavformat/rtsp.c
@@ -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:
--
1.7.3.1
More information about the ffmpeg-devel
mailing list