libavformat/rtsp.c:1147: error: Uninitialized Value
  The value read from rtx was never initialized.

libavformat/rtsp.c:1147:44: 
1145.                 rtsp_st = rt->rtsp_streams[rtx];
1146.             } else
1147.                 rtsp_st = rt->rtsp_streams[i > rtx ? i : i - 1];
                                                 ^
1148.         } else
1149.             rtsp_st = rt->rtsp_streams[i];

int ff_rtsp_make_setup_request(AVFormatContext *s, const char *host, int port,
                              int lower_transport, const char *real_challenge)
{
    RTSPState *rt = s->priv_data;
    int rtx, j, i, err, interleave = 0;
    RTSPStream *rtsp_st;
    RTSPMessageHeader reply1, *reply = &reply1;
    char cmd[2048];
    const char *trans_pref;
    if (rt->transport == RTSP_TRANSPORT_RDT)
        trans_pref = "x-pn-tng";
    else
        trans_pref = "RTP/AVP";
    rt->timeout = 60;
    for (j = RTSP_RTP_PORT_MIN, i = 0; i < rt->nb_rtsp_streams; ++i) {
        char transport[2048];
        if (lower_transport == RTSP_LOWER_TRANSPORT_UDP &&
             rt->server_type == RTSP_SERVER_WMS) {
            if (i == 0) {
                for (rtx = 0; rtx < rt->nb_rtsp_streams; rtx++) {
                    int len = strlen(rt->rtsp_streams[rtx]->control_url);
                    if (len >= 4 &&
                        !strcmp(rt->rtsp_streams[rtx]->control_url + len - 4,
                                "/rtx"))
                        break;
                }
                if (rtx == rt->nb_rtsp_streams)
                    return -1;
                rtsp_st = rt->rtsp_streams[rtx];
            } else
                rtsp_st = rt->rtsp_streams[i > rtx ? i : i - 1];
        } else
            rtsp_st = rt->rtsp_streams[i];
        if (lower_transport == RTSP_LOWER_TRANSPORT_UDP) {
            char buf[256];
            if (rt->server_type == RTSP_SERVER_WMS && i > 1) {
                port = reply->transports[0].client_port_min;
                goto have_port;
            }
            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);
                    j += 2;
                    if (ffurl_open(&rtsp_st->rtp_handle, buf, AVIO_FLAG_READ_WRITE,
                                   &s->interrupt_callback, NULL) == 0)
                        goto rtp_opened;
                }
            }
            av_log(s, AV_LOG_ERROR, "Unable to open an input RTP port\n");
            err = AVERROR(EIO);
            goto fail;
        rtp_opened:
            port = ff_rtp_get_local_rtp_port(rtsp_st->rtp_handle);
        have_port:
            snprintf(transport, sizeof(transport) - 1,
                     "%s/UDP;", trans_pref);
            if (rt->server_type != RTSP_SERVER_REAL)
                av_strlcat(transport, "unicast;", sizeof(transport));
            av_strlcatf(transport, sizeof(transport),
                     "client_port=%d", port);
            if (rt->transport == RTSP_TRANSPORT_RTP &&
                !(rt->server_type == RTSP_SERVER_WMS && i > 0))
                av_strlcatf(transport, sizeof(transport), "-%d", port + 1);
        }
        else if (lower_transport == RTSP_LOWER_TRANSPORT_TCP) {
            if (rt->server_type == RTSP_SERVER_WMS &&
                s->streams[rtsp_st->stream_index]->codec->codec_type ==
                    AVMEDIA_TYPE_DATA)
                continue;
            snprintf(transport, sizeof(transport) - 1,
                     "%s/TCP;", trans_pref);
            if (rt->transport != RTSP_TRANSPORT_RDT)
                av_strlcat(transport, "unicast;", sizeof(transport));
            av_strlcatf(transport, sizeof(transport),
                        "interleaved=%d-%d",
                        interleave, interleave + 1);
            interleave += 2;
        }
        else if (lower_transport == RTSP_LOWER_TRANSPORT_UDP_MULTICAST) {
            snprintf(transport, sizeof(transport) - 1,
                     "%s/UDP;multicast", trans_pref);
        }
        if (s->oformat) {
            av_strlcat(transport, ";mode=receive", sizeof(transport));
        } else if (rt->server_type == RTSP_SERVER_REAL ||
                   rt->server_type == RTSP_SERVER_WMS)
            av_strlcat(transport, ";mode=play", sizeof(transport));
        snprintf(cmd, sizeof(cmd),
                 "Transport: %s\r\n",
                 transport);
        if (rt->accept_dynamic_rate)
            av_strlcat(cmd, "x-Dynamic-Rate: 0\r\n", sizeof(cmd));
        if (i == 0 && rt->server_type == RTSP_SERVER_REAL && CONFIG_RTPDEC) {
            char real_res[41], real_csum[9];
            ff_rdt_calc_response_and_checksum(real_res, real_csum,
                                              real_challenge);
            av_strlcatf(cmd, sizeof(cmd),
                        "If-Match: %s\r\n"
                        "RealChallenge2: %s, sd=%s\r\n",
                        rt->session_id, real_res, real_csum);
        }
        ff_rtsp_send_cmd(s, "SETUP", rtsp_st->control_url, cmd, reply, NULL);
        if (reply->status_code == 461   && i == 0) {
            err = 1;
            goto fail;
        } else if (reply->status_code != RTSP_STATUS_OK ||
                   reply->nb_transports != 1) {
            err = AVERROR_INVALIDDATA;
            goto fail;
        }
        if (i > 0) {
            if (reply->transports[0].lower_transport != rt->lower_transport ||
                reply->transports[0].transport != rt->transport) {
                err = AVERROR_INVALIDDATA;
                goto fail;
            }
        } else {
            rt->lower_transport = reply->transports[0].lower_transport;
            rt->transport = reply->transports[0].transport;
        }
        if (reply->transports[0].lower_transport != lower_transport) {
            av_log(s, AV_LOG_ERROR, "Nonmatching transport in server reply\n");
            err = AVERROR_INVALIDDATA;
            goto fail;
        }
        switch(reply->transports[0].lower_transport) {
        case RTSP_LOWER_TRANSPORT_TCP:
            rtsp_st->interleaved_min = reply->transports[0].interleaved_min;
            rtsp_st->interleaved_max = reply->transports[0].interleaved_max;
            break;
        case RTSP_LOWER_TRANSPORT_UDP: {
            char url[1024], options[30] = "";
            if (rt->rtsp_flags & RTSP_FLAG_FILTER_SRC)
                av_strlcpy(options, "?connect=1", sizeof(options));
            if (reply->transports[0].source[0]) {
                ff_url_join(url, sizeof(url), "rtp", NULL,
                            reply->transports[0].source,
                            reply->transports[0].server_port_min, "%s", options);
            } else {
                ff_url_join(url, sizeof(url), "rtp", NULL, host,
                            reply->transports[0].server_port_min, "%s", options);
            }
            if (!(rt->server_type == RTSP_SERVER_WMS && i > 1) &&
                ff_rtp_set_remote_url(rtsp_st->rtp_handle, url) < 0) {
                err = AVERROR_INVALIDDATA;
                goto fail;
            }
            if (!(rt->server_type == RTSP_SERVER_WMS && i > 1) && s->iformat &&
                CONFIG_RTPDEC)
                ff_rtp_send_punch_packets(rtsp_st->rtp_handle);
            break;
        }
        case RTSP_LOWER_TRANSPORT_UDP_MULTICAST: {
            char url[1024], namebuf[50];
            struct sockaddr_storage addr;
            int port, ttl;
            if (reply->transports[0].destination.ss_family) {
                addr      = reply->transports[0].destination;
                port      = reply->transports[0].port_min;
                ttl       = reply->transports[0].ttl;
            } else {
                addr      = rtsp_st->sdp_ip;
                port      = rtsp_st->sdp_port;
                ttl       = rtsp_st->sdp_ttl;
            }
            getnameinfo((struct sockaddr*) &addr, sizeof(addr),
                        namebuf, sizeof(namebuf), NULL, 0, NI_NUMERICHOST);
            ff_url_join(url, sizeof(url), "rtp", NULL, namebuf,
                        port, "?ttl=%d", ttl);
            if (ffurl_open(&rtsp_st->rtp_handle, url, AVIO_FLAG_READ_WRITE,
                           &s->interrupt_callback, NULL) < 0) {
                err = AVERROR_INVALIDDATA;
                goto fail;
            }
            break;
        }
        }
        if ((err = rtsp_open_transport_ctx(s, rtsp_st)))
            goto fail;
    }
    if (reply->timeout > 0)
        rt->timeout = reply->timeout;
    if (rt->server_type == RTSP_SERVER_REAL)
        rt->need_subscription = 1;
    return 0;
fail:
    ff_rtsp_undo_setup(s);
    return err;
}
['int ff_rtsp_make_setup_request(AVFormatContext *s, const char *host, int port,\n                              int lower_transport, const char *real_challenge)\n{\n    RTSPState *rt = s->priv_data;\n    int rtx, j, i, err, interleave = 0;\n    RTSPStream *rtsp_st;\n    RTSPMessageHeader reply1, *reply = &reply1;\n    char cmd[2048];\n    const char *trans_pref;\n    if (rt->transport == RTSP_TRANSPORT_RDT)\n        trans_pref = "x-pn-tng";\n    else\n        trans_pref = "RTP/AVP";\n    rt->timeout = 60;\n    for (j = RTSP_RTP_PORT_MIN, i = 0; i < rt->nb_rtsp_streams; ++i) {\n        char transport[2048];\n        if (lower_transport == RTSP_LOWER_TRANSPORT_UDP &&\n             rt->server_type == RTSP_SERVER_WMS) {\n            if (i == 0) {\n                for (rtx = 0; rtx < rt->nb_rtsp_streams; rtx++) {\n                    int len = strlen(rt->rtsp_streams[rtx]->control_url);\n                    if (len >= 4 &&\n                        !strcmp(rt->rtsp_streams[rtx]->control_url + len - 4,\n                                "/rtx"))\n                        break;\n                }\n                if (rtx == rt->nb_rtsp_streams)\n                    return -1;\n                rtsp_st = rt->rtsp_streams[rtx];\n            } else\n                rtsp_st = rt->rtsp_streams[i > rtx ? i : i - 1];\n        } else\n            rtsp_st = rt->rtsp_streams[i];\n        if (lower_transport == RTSP_LOWER_TRANSPORT_UDP) {\n            char buf[256];\n            if (rt->server_type == RTSP_SERVER_WMS && i > 1) {\n                port = reply->transports[0].client_port_min;\n                goto have_port;\n            }\n            if (RTSP_RTP_PORT_MIN != 0) {\n                while (j <= RTSP_RTP_PORT_MAX) {\n                    ff_url_join(buf, sizeof(buf), "rtp", NULL, host, -1,\n                                "?localport=%d", j);\n                    j += 2;\n                    if (ffurl_open(&rtsp_st->rtp_handle, buf, AVIO_FLAG_READ_WRITE,\n                                   &s->interrupt_callback, NULL) == 0)\n                        goto rtp_opened;\n                }\n            }\n            av_log(s, AV_LOG_ERROR, "Unable to open an input RTP port\\n");\n            err = AVERROR(EIO);\n            goto fail;\n        rtp_opened:\n            port = ff_rtp_get_local_rtp_port(rtsp_st->rtp_handle);\n        have_port:\n            snprintf(transport, sizeof(transport) - 1,\n                     "%s/UDP;", trans_pref);\n            if (rt->server_type != RTSP_SERVER_REAL)\n                av_strlcat(transport, "unicast;", sizeof(transport));\n            av_strlcatf(transport, sizeof(transport),\n                     "client_port=%d", port);\n            if (rt->transport == RTSP_TRANSPORT_RTP &&\n                !(rt->server_type == RTSP_SERVER_WMS && i > 0))\n                av_strlcatf(transport, sizeof(transport), "-%d", port + 1);\n        }\n        else if (lower_transport == RTSP_LOWER_TRANSPORT_TCP) {\n            if (rt->server_type == RTSP_SERVER_WMS &&\n                s->streams[rtsp_st->stream_index]->codec->codec_type ==\n                    AVMEDIA_TYPE_DATA)\n                continue;\n            snprintf(transport, sizeof(transport) - 1,\n                     "%s/TCP;", trans_pref);\n            if (rt->transport != RTSP_TRANSPORT_RDT)\n                av_strlcat(transport, "unicast;", sizeof(transport));\n            av_strlcatf(transport, sizeof(transport),\n                        "interleaved=%d-%d",\n                        interleave, interleave + 1);\n            interleave += 2;\n        }\n        else if (lower_transport == RTSP_LOWER_TRANSPORT_UDP_MULTICAST) {\n            snprintf(transport, sizeof(transport) - 1,\n                     "%s/UDP;multicast", trans_pref);\n        }\n        if (s->oformat) {\n            av_strlcat(transport, ";mode=receive", sizeof(transport));\n        } else if (rt->server_type == RTSP_SERVER_REAL ||\n                   rt->server_type == RTSP_SERVER_WMS)\n            av_strlcat(transport, ";mode=play", sizeof(transport));\n        snprintf(cmd, sizeof(cmd),\n                 "Transport: %s\\r\\n",\n                 transport);\n        if (rt->accept_dynamic_rate)\n            av_strlcat(cmd, "x-Dynamic-Rate: 0\\r\\n", sizeof(cmd));\n        if (i == 0 && rt->server_type == RTSP_SERVER_REAL && CONFIG_RTPDEC) {\n            char real_res[41], real_csum[9];\n            ff_rdt_calc_response_and_checksum(real_res, real_csum,\n                                              real_challenge);\n            av_strlcatf(cmd, sizeof(cmd),\n                        "If-Match: %s\\r\\n"\n                        "RealChallenge2: %s, sd=%s\\r\\n",\n                        rt->session_id, real_res, real_csum);\n        }\n        ff_rtsp_send_cmd(s, "SETUP", rtsp_st->control_url, cmd, reply, NULL);\n        if (reply->status_code == 461   && i == 0) {\n            err = 1;\n            goto fail;\n        } else if (reply->status_code != RTSP_STATUS_OK ||\n                   reply->nb_transports != 1) {\n            err = AVERROR_INVALIDDATA;\n            goto fail;\n        }\n        if (i > 0) {\n            if (reply->transports[0].lower_transport != rt->lower_transport ||\n                reply->transports[0].transport != rt->transport) {\n                err = AVERROR_INVALIDDATA;\n                goto fail;\n            }\n        } else {\n            rt->lower_transport = reply->transports[0].lower_transport;\n            rt->transport = reply->transports[0].transport;\n        }\n        if (reply->transports[0].lower_transport != lower_transport) {\n            av_log(s, AV_LOG_ERROR, "Nonmatching transport in server reply\\n");\n            err = AVERROR_INVALIDDATA;\n            goto fail;\n        }\n        switch(reply->transports[0].lower_transport) {\n        case RTSP_LOWER_TRANSPORT_TCP:\n            rtsp_st->interleaved_min = reply->transports[0].interleaved_min;\n            rtsp_st->interleaved_max = reply->transports[0].interleaved_max;\n            break;\n        case RTSP_LOWER_TRANSPORT_UDP: {\n            char url[1024], options[30] = "";\n            if (rt->rtsp_flags & RTSP_FLAG_FILTER_SRC)\n                av_strlcpy(options, "?connect=1", sizeof(options));\n            if (reply->transports[0].source[0]) {\n                ff_url_join(url, sizeof(url), "rtp", NULL,\n                            reply->transports[0].source,\n                            reply->transports[0].server_port_min, "%s", options);\n            } else {\n                ff_url_join(url, sizeof(url), "rtp", NULL, host,\n                            reply->transports[0].server_port_min, "%s", options);\n            }\n            if (!(rt->server_type == RTSP_SERVER_WMS && i > 1) &&\n                ff_rtp_set_remote_url(rtsp_st->rtp_handle, url) < 0) {\n                err = AVERROR_INVALIDDATA;\n                goto fail;\n            }\n            if (!(rt->server_type == RTSP_SERVER_WMS && i > 1) && s->iformat &&\n                CONFIG_RTPDEC)\n                ff_rtp_send_punch_packets(rtsp_st->rtp_handle);\n            break;\n        }\n        case RTSP_LOWER_TRANSPORT_UDP_MULTICAST: {\n            char url[1024], namebuf[50];\n            struct sockaddr_storage addr;\n            int port, ttl;\n            if (reply->transports[0].destination.ss_family) {\n                addr      = reply->transports[0].destination;\n                port      = reply->transports[0].port_min;\n                ttl       = reply->transports[0].ttl;\n            } else {\n                addr      = rtsp_st->sdp_ip;\n                port      = rtsp_st->sdp_port;\n                ttl       = rtsp_st->sdp_ttl;\n            }\n            getnameinfo((struct sockaddr*) &addr, sizeof(addr),\n                        namebuf, sizeof(namebuf), NULL, 0, NI_NUMERICHOST);\n            ff_url_join(url, sizeof(url), "rtp", NULL, namebuf,\n                        port, "?ttl=%d", ttl);\n            if (ffurl_open(&rtsp_st->rtp_handle, url, AVIO_FLAG_READ_WRITE,\n                           &s->interrupt_callback, NULL) < 0) {\n                err = AVERROR_INVALIDDATA;\n                goto fail;\n            }\n            break;\n        }\n        }\n        if ((err = rtsp_open_transport_ctx(s, rtsp_st)))\n            goto fail;\n    }\n    if (reply->timeout > 0)\n        rt->timeout = reply->timeout;\n    if (rt->server_type == RTSP_SERVER_REAL)\n        rt->need_subscription = 1;\n    return 0;\nfail:\n    ff_rtsp_undo_setup(s);\n    return err;\n}']