Revision 8a8754d8

View differences:

libavformat/rtsp.c
922 922
                 "Transport: %s\r\n",
923 923
                 rtsp_st->control_url, transport);
924 924
        rtsp_send_cmd(s, cmd, reply, NULL);
925
        if (reply->status_code == 461 /* Unsupported protocol */ && i == 0) {
926
            err = 1;
927
            goto fail;
928
        } else
925 929
        if (reply->status_code != RTSP_STATUS_OK ||
926 930
            reply->nb_transports != 1) {
927 931
            err = AVERROR_INVALIDDATA;
......
1003 1007
    return 0;
1004 1008

  
1005 1009
fail:
1010
    for (i=0; i<rt->nb_rtsp_streams; i++) {
1011
        if (rt->rtsp_streams[i]->rtp_handle) {
1012
            url_close(rt->rtsp_streams[i]->rtp_handle);
1013
            rt->rtsp_streams[i]->rtp_handle = NULL;
1014
        }
1015
    }
1006 1016
    return err;
1007 1017
}
1008 1018

  
......
1045 1055
    }
1046 1056

  
1047 1057
    if (!protocol_mask)
1048
        protocol_mask = rtsp_default_protocols;
1058
        protocol_mask = (1 << RTSP_PROTOCOL_RTP_LAST) - 1;
1049 1059

  
1050 1060
    /* open the tcp connexion */
1051 1061
    snprintf(tcpname, sizeof(tcpname), "tcp://%s:%d", host, port);
......
1077 1087
        goto fail;
1078 1088
    }
1079 1089

  
1080
    err = make_setup_request(s, host, port, protocol_mask);
1081
    if (err)
1090
    do {
1091
        int protocol = protocol_mask & ~(protocol_mask - 1);
1092

  
1093
        err = make_setup_request(s, host, port, protocol);
1094
        if (err < 0)
1082 1095
        goto fail;
1096
        protocol_mask &= ~protocol;
1097
        if (protocol_mask == 0 && err == 1) {
1098
            err = AVERROR(EPROTONOSUPPORT);
1099
            goto fail;
1100
        }
1101
    } while (err);
1083 1102

  
1084 1103
    rt->state = RTSP_STATE_IDLE;
1085 1104
    rt->seek_timestamp = 0; /* default is to start stream at position
libavformat/rtsp.h
29 29
    RTSP_PROTOCOL_RTP_UDP = 0,
30 30
    RTSP_PROTOCOL_RTP_TCP = 1,
31 31
    RTSP_PROTOCOL_RTP_UDP_MULTICAST = 2,
32
    /**
33
     * This is not part of public API and shouldn't be used outside of ffmpeg.
34
     */
35
    RTSP_PROTOCOL_RTP_LAST
32 36
};
33 37

  
34 38
#define RTSP_DEFAULT_PORT   554

Also available in: Unified diff