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

Michael Niedermayer michaelni at gmx.at
Thu Oct 23 20:23:27 CEST 2014


On Thu, Oct 23, 2014 at 08:55:45PM +0400, Andrey Utkin wrote:
> 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;

why doesnt this write into err directly without ret ?


[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The greatest way to live with honor in this world is to be what we pretend
to be. -- Socrates
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20141023/6634f27d/attachment.asc>


More information about the ffmpeg-devel mailing list