| Index: source/patched-ffmpeg-mt/libavformat/rtsp.c
|
| ===================================================================
|
| --- source/patched-ffmpeg-mt/libavformat/rtsp.c (revision 50820)
|
| +++ source/patched-ffmpeg-mt/libavformat/rtsp.c (working copy)
|
| @@ -273,9 +273,7 @@
|
| static void sdp_parse_fmtp(AVStream *st, const char *p)
|
| {
|
| char attr[256];
|
| - /* Vorbis setup headers can be up to 12KB and are sent base64
|
| - * encoded, giving a 12KB * (4/3) = 16KB FMTP line. */
|
| - char value[16384];
|
| + char value[4096];
|
| int i;
|
| RTSPStream *rtsp_st = st->priv_data;
|
| AVCodecContext *codec = st->codec;
|
| @@ -541,7 +539,8 @@
|
| * "rulebooks" describing their properties. Therefore, the SDP line
|
| * buffer is large.
|
| *
|
| - * The Vorbis FMTP line can be up to 16KB - see sdp_parse_fmtp. */
|
| + * The Vorbis FMTP line can be up to 16KB - see xiph_parse_sdp_line
|
| + * in rtpdec_xiph.c. */
|
| char buf[16384], *q;
|
| SDPParseState sdp_parse_state, *s1 = &sdp_parse_state;
|
|
|
| @@ -1484,6 +1483,7 @@
|
| RTSPState *rt = s->priv_data;
|
| if (rt->rtsp_hd_out != rt->rtsp_hd) url_close(rt->rtsp_hd_out);
|
| url_close(rt->rtsp_hd);
|
| + rt->rtsp_hd = rt->rtsp_hd_out = NULL;
|
| }
|
|
|
| int ff_rtsp_connect(AVFormatContext *s)
|
| @@ -1491,7 +1491,6 @@
|
| RTSPState *rt = s->priv_data;
|
| char host[1024], path[1024], tcpname[1024], cmd[2048], auth[128];
|
| char *option_list, *option, *filename;
|
| - URLContext *rtsp_hd, *rtsp_hd_out;
|
| int port, err, tcp_fd;
|
| RTSPMessageHeader reply1 = {}, *reply = &reply1;
|
| int lower_transport_mask = 0;
|
| @@ -1574,12 +1573,12 @@
|
| char sessioncookie[17];
|
| char headers[1024];
|
|
|
| - ff_url_join(httpname, sizeof(httpname), "http", NULL, host, port, "%s", path);
|
| + ff_url_join(httpname, sizeof(httpname), "http", auth, host, port, "%s", path);
|
| snprintf(sessioncookie, sizeof(sessioncookie), "%08x%08x",
|
| av_get_random_seed(), av_get_random_seed());
|
|
|
| /* GET requests */
|
| - if (url_open(&rtsp_hd, httpname, URL_RDONLY) < 0) {
|
| + if (url_open(&rt->rtsp_hd, httpname, URL_RDONLY) < 0) {
|
| err = AVERROR(EIO);
|
| goto fail;
|
| }
|
| @@ -1591,16 +1590,16 @@
|
| "Pragma: no-cache\r\n"
|
| "Cache-Control: no-cache\r\n",
|
| sessioncookie);
|
| - ff_http_set_headers(rtsp_hd, headers);
|
| + ff_http_set_headers(rt->rtsp_hd, headers);
|
|
|
| /* complete the connection */
|
| - if (url_read(rtsp_hd, NULL, 0)) {
|
| + if (url_read(rt->rtsp_hd, NULL, 0)) {
|
| err = AVERROR(EIO);
|
| goto fail;
|
| }
|
|
|
| /* POST requests */
|
| - if (url_open(&rtsp_hd_out, httpname, URL_WRONLY) < 0 ) {
|
| + if (url_open(&rt->rtsp_hd_out, httpname, URL_WRONLY) < 0 ) {
|
| err = AVERROR(EIO);
|
| goto fail;
|
| }
|
| @@ -1614,23 +1613,21 @@
|
| "Content-Length: 32767\r\n"
|
| "Expires: Sun, 9 Jan 1972 00:00:00 GMT\r\n",
|
| sessioncookie);
|
| - ff_http_set_headers(rtsp_hd_out, headers);
|
| - ff_http_set_chunked_transfer_encoding(rtsp_hd_out, 0);
|
| + ff_http_set_headers(rt->rtsp_hd_out, headers);
|
| + ff_http_set_chunked_transfer_encoding(rt->rtsp_hd_out, 0);
|
|
|
| } else {
|
| - /* open the tcp connexion */
|
| - ff_url_join(tcpname, sizeof(tcpname), "tcp", NULL, host, port, NULL);
|
| - if (url_open(&rtsp_hd, tcpname, URL_RDWR) < 0) {
|
| - err = AVERROR(EIO);
|
| - goto fail;
|
| + /* open the tcp connection */
|
| + ff_url_join(tcpname, sizeof(tcpname), "tcp", NULL, host, port, NULL);
|
| + if (url_open(&rt->rtsp_hd, tcpname, URL_RDWR) < 0) {
|
| + err = AVERROR(EIO);
|
| + goto fail;
|
| + }
|
| + rt->rtsp_hd_out = rt->rtsp_hd;
|
| }
|
| - rtsp_hd_out = rtsp_hd;
|
| - }
|
| - rt->rtsp_hd = rtsp_hd;
|
| - rt->rtsp_hd_out = rtsp_hd_out;
|
| rt->seq = 0;
|
|
|
| - tcp_fd = url_get_file_handle(rtsp_hd);
|
| + tcp_fd = url_get_file_handle(rt->rtsp_hd);
|
| if (!getpeername(tcp_fd, (struct sockaddr*) &peer, &peer_len)) {
|
| getnameinfo((struct sockaddr*) &peer, peer_len, host, sizeof(host),
|
| NULL, 0, NI_NUMERICHOST);
|
|
|