Commit 6294d708 authored by Martin Storsjö's avatar Martin Storsjö

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: 's avatarMartin Storsjö <martin@martin.st>
parent 2bfd92b3
...@@ -1350,7 +1350,7 @@ int ff_rtsp_make_setup_request(AVFormatContext *s, const char *host, int port, ...@@ -1350,7 +1350,7 @@ int ff_rtsp_make_setup_request(AVFormatContext *s, const char *host, int port,
break; break;
} }
case RTSP_LOWER_TRANSPORT_UDP_MULTICAST: { case RTSP_LOWER_TRANSPORT_UDP_MULTICAST: {
char url[1024], namebuf[50]; char url[1024], namebuf[50], optbuf[20] = "";
struct sockaddr_storage addr; struct sockaddr_storage addr;
int port, ttl; int port, ttl;
...@@ -1363,10 +1363,12 @@ int ff_rtsp_make_setup_request(AVFormatContext *s, const char *host, int port, ...@@ -1363,10 +1363,12 @@ int ff_rtsp_make_setup_request(AVFormatContext *s, const char *host, int port,
port = rtsp_st->sdp_port; port = rtsp_st->sdp_port;
ttl = rtsp_st->sdp_ttl; ttl = rtsp_st->sdp_ttl;
} }
if (ttl > 0)
snprintf(optbuf, sizeof(optbuf), "?ttl=%d", ttl);
getnameinfo((struct sockaddr*) &addr, sizeof(addr), getnameinfo((struct sockaddr*) &addr, sizeof(addr),
namebuf, sizeof(namebuf), NULL, 0, NI_NUMERICHOST); namebuf, sizeof(namebuf), NULL, 0, NI_NUMERICHOST);
ff_url_join(url, sizeof(url), "rtp", NULL, namebuf, 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, if (ffurl_open(&rtsp_st->rtp_handle, url, AVIO_FLAG_READ_WRITE,
&s->interrupt_callback, NULL) < 0) { &s->interrupt_callback, NULL) < 0) {
err = AVERROR_INVALIDDATA; err = AVERROR_INVALIDDATA;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment