[FFmpeg-devel] [PATCH 1/2] rtsp: pass return code from ffurl_open() on its failure

Andrey Utkin andrey.utkin at corp.bluecherry.net
Thu Oct 23 18:55:45 CEST 2014


Previously, AVERROR(EIO) was returned. Now the value is passed from
lower level, thus it is possible to distinguish ECONNREFUSED, ETIMEDOUT,
ENETUNREACH etc.
---
 libavformat/rtsp.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
index 1682db8..f054293 100644
--- a/libavformat/rtsp.c
+++ b/libavformat/rtsp.c
@@ -1600,6 +1600,7 @@ int ff_rtsp_connect(AVFormatContext *s)
     char real_challenge[64] = "";
     struct sockaddr_storage peer;
     socklen_t peer_len = sizeof(peer);
+    int ret;
 
     if (rt->rtp_port_max < rt->rtp_port_min) {
         av_log(s, AV_LOG_ERROR, "Invalid UDP port range, max port %d less "
@@ -1741,9 +1742,9 @@ redirect:
         ff_url_join(tcpname, sizeof(tcpname), lower_rtsp_proto, NULL,
                     host, port,
                     "?timeout=%d", rt->stimeout);
-        if (ffurl_open(&rt->rtsp_hd, tcpname, AVIO_FLAG_READ_WRITE,
-                       &s->interrupt_callback, NULL) < 0) {
-            err = AVERROR(EIO);
+        if ((ret = ffurl_open(&rt->rtsp_hd, tcpname, AVIO_FLAG_READ_WRITE,
+                       &s->interrupt_callback, NULL)) < 0) {
+            err = ret;
             goto fail;
         }
         rt->rtsp_hd_out = rt->rtsp_hd;
-- 
1.8.5.5



More information about the ffmpeg-devel mailing list