[libav-devel] [PATCH 2/2] rtmp: Pass the proper return code in rtmp_handshake

Martin Storsjö martin at martin.st
Thu May 24 14:01:57 CEST 2012


On Thu, 24 May 2012, Samuel Pitoiset wrote:

> ---
> libavformat/rtmpproto.c |   13 +++++++------
> 1 file changed, 7 insertions(+), 6 deletions(-)
>
> diff --git a/libavformat/rtmpproto.c b/libavformat/rtmpproto.c
> index 1f78d1c..9af4584 100644
> --- a/libavformat/rtmpproto.c
> +++ b/libavformat/rtmpproto.c
> @@ -639,15 +639,16 @@ static int rtmp_handshake(URLContext *s, RTMPContext *rt)
>         return ret;
>     }
>
> -    i = ffurl_read_complete(rt->stream, serverdata, RTMP_HANDSHAKE_PACKET_SIZE + 1);
> -    if (i != RTMP_HANDSHAKE_PACKET_SIZE + 1) {
> +    if ((ret = ffurl_read_complete(rt->stream, serverdata,
> +                                   RTMP_HANDSHAKE_PACKET_SIZE + 1)) < 0) {
>         av_log(s, AV_LOG_ERROR, "Cannot read RTMP handshake response\n");
> -        return AVERROR(EIO);
> +        return ret;
>     }
> -    i = ffurl_read_complete(rt->stream, clientdata, RTMP_HANDSHAKE_PACKET_SIZE);
> -    if (i != RTMP_HANDSHAKE_PACKET_SIZE) {
> +
> +    if ((ret = ffurl_read_complete(rt->stream, clientdata,
> +                                   RTMP_HANDSHAKE_PACKET_SIZE)) < 0) {
>         av_log(s, AV_LOG_ERROR, "Cannot read RTMP handshake response\n");
> -        return AVERROR(EIO);
> +        return ret;
>     }
>
>     av_log(s, AV_LOG_DEBUG, "Server version %d.%d.%d.%d\n",
> -- 
> 1.7.10.2

LGTM

// Martin


More information about the libav-devel mailing list