Skip to content
Snippets Groups Projects
Commit ee37d581 authored by Martin Storsjö's avatar Martin Storsjö
Browse files

rtpproto: Allow specifying a separate rtcp port in ff_rtp_set_remote_url


A separate rtcp port can already be set when opening the rtp
protocol normally, but when doing port setup as in RTSP (where
we first need to open the local ports and pass them to the peer,
and only then receive the remote peer port numbers), we didn't
check the same url parameter as in the normal open routine.

Signed-off-by: default avatarMartin Storsjö <martin@martin.st>
parent 1851e1d0
No related branches found
No related tags found
No related merge requests found
...@@ -61,18 +61,27 @@ int ff_rtp_set_remote_url(URLContext *h, const char *uri) ...@@ -61,18 +61,27 @@ int ff_rtp_set_remote_url(URLContext *h, const char *uri)
{ {
RTPContext *s = h->priv_data; RTPContext *s = h->priv_data;
char hostname[256]; char hostname[256];
int port; int port, rtcp_port;
const char *p;
char buf[1024]; char buf[1024];
char path[1024]; char path[1024];
av_url_split(NULL, 0, NULL, 0, hostname, sizeof(hostname), &port, av_url_split(NULL, 0, NULL, 0, hostname, sizeof(hostname), &port,
path, sizeof(path), uri); path, sizeof(path), uri);
rtcp_port = port + 1;
p = strchr(uri, '?');
if (p) {
if (av_find_info_tag(buf, sizeof(buf), "rtcpport", p)) {
rtcp_port = strtol(buf, NULL, 10);
}
}
ff_url_join(buf, sizeof(buf), "udp", NULL, hostname, port, "%s", path); ff_url_join(buf, sizeof(buf), "udp", NULL, hostname, port, "%s", path);
ff_udp_set_remote_url(s->rtp_hd, buf); ff_udp_set_remote_url(s->rtp_hd, buf);
ff_url_join(buf, sizeof(buf), "udp", NULL, hostname, port + 1, "%s", path); ff_url_join(buf, sizeof(buf), "udp", NULL, hostname, rtcp_port, "%s", path);
ff_udp_set_remote_url(s->rtcp_hd, buf); ff_udp_set_remote_url(s->rtcp_hd, buf);
return 0; return 0;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment