diff options
author | John Wimer <john@god.vtic.net> | 2010-09-03 19:25:59 +0000 |
---|---|---|
committer | Ronald S. Bultje <rsbultje@gmail.com> | 2010-09-03 19:25:59 +0000 |
commit | 619298a84dcad59e42062a00b8ffe422a1a38d7c (patch) | |
tree | 7174f30ee1300d019672e600051ce39beca7cf05 /libavformat/rtsp.c | |
parent | 2c166c3af15a2333090075608590e1229dcce552 (diff) | |
download | ffmpeg-619298a84dcad59e42062a00b8ffe422a1a38d7c.tar.gz |
Send NAT punching messages to the address specified in the Transport:
message, if available (RFC 2326, section 12.39), fixes issue 2212.
Patch by John Wimer <john at god vtic net>.
Originally committed as revision 25032 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/rtsp.c')
-rw-r--r-- | libavformat/rtsp.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c index be3eee6411..4ab2c33489 100644 --- a/libavformat/rtsp.c +++ b/libavformat/rtsp.c @@ -701,7 +701,14 @@ static void rtsp_parse_transport(RTSPMessageHeader *reply, const char *p) get_word_sep(buf, sizeof(buf), ";,", &p); get_sockaddr(buf, &th->destination); } + } else if (!strcmp(parameter, "source")) { + if (*p == '=') { + p++; + get_word_sep(buf, sizeof(buf), ";,", &p); + av_strlcpy(th->source, buf, sizeof(th->source)); + } } + while (*p != ';' && *p != '\0' && *p != ',') p++; if (*p == ';') @@ -1154,9 +1161,15 @@ static int make_setup_request(AVFormatContext *s, const char *host, int port, case RTSP_LOWER_TRANSPORT_UDP: { char url[1024]; - /* XXX: also use address if specified */ + /* Use source address if specified */ + if (reply->transports[0].source[0]) { + ff_url_join(url, sizeof(url), "rtp", NULL, + reply->transports[0].source, + reply->transports[0].server_port_min, NULL); + } else { ff_url_join(url, sizeof(url), "rtp", NULL, host, reply->transports[0].server_port_min, NULL); + } if (!(rt->server_type == RTSP_SERVER_WMS && i > 1) && rtp_set_remote_url(rtsp_st->rtp_handle, url) < 0) { err = AVERROR_INVALIDDATA; |