diff options
author | Martin Storsjö <martin@martin.st> | 2012-03-08 15:32:39 +0200 |
---|---|---|
committer | Martin Storsjö <martin@martin.st> | 2012-03-09 15:04:32 +0200 |
commit | 6294d708b8be886767f6181169143c29c975938f (patch) | |
tree | d39a6e6cb15143498153941d4012dd5506dd75eb /libavformat | |
parent | 2bfd92b33089b38ce73f845a3b30f94688742fd4 (diff) | |
download | ffmpeg-6294d708b8be886767f6181169143c29c975938f.tar.gz |
rtsp: Only set the ttl parameter if the server actually gave a value
Passing ttl=0 to the rtp/udp url contexts makes packets never
leave the host machine.
Signed-off-by: Martin Storsjö <martin@martin.st>
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/rtsp.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c index dd79407036..9df88b30aa 100644 --- a/libavformat/rtsp.c +++ b/libavformat/rtsp.c @@ -1350,7 +1350,7 @@ int ff_rtsp_make_setup_request(AVFormatContext *s, const char *host, int port, break; } case RTSP_LOWER_TRANSPORT_UDP_MULTICAST: { - char url[1024], namebuf[50]; + char url[1024], namebuf[50], optbuf[20] = ""; struct sockaddr_storage addr; int port, ttl; @@ -1363,10 +1363,12 @@ int ff_rtsp_make_setup_request(AVFormatContext *s, const char *host, int port, port = rtsp_st->sdp_port; ttl = rtsp_st->sdp_ttl; } + if (ttl > 0) + snprintf(optbuf, sizeof(optbuf), "?ttl=%d", 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); + port, "%s", optbuf); if (ffurl_open(&rtsp_st->rtp_handle, url, AVIO_FLAG_READ_WRITE, &s->interrupt_callback, NULL) < 0) { err = AVERROR_INVALIDDATA; |