X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavformat%2Frtpproto.c;h=00a3bcd3ba9564f3430cad94557535d8554e5128;hb=a5ef7960fc96ed773acc4149104d6acf534e8a87;hp=b109ac84020ec647bbc282ed32716b43dcd9e282;hpb=4f07fcd30b0e910d11e08172549a301beffd7e3a;p=ffmpeg diff --git a/libavformat/rtpproto.c b/libavformat/rtpproto.c index b109ac84020..00a3bcd3ba9 100644 --- a/libavformat/rtpproto.c +++ b/libavformat/rtpproto.c @@ -61,18 +61,27 @@ int ff_rtp_set_remote_url(URLContext *h, const char *uri) { RTPContext *s = h->priv_data; char hostname[256]; - int port; + int port, rtcp_port; + const char *p; char buf[1024]; char path[1024]; av_url_split(NULL, 0, NULL, 0, hostname, sizeof(hostname), &port, 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_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); return 0; } @@ -369,6 +378,9 @@ static int rtp_write(URLContext *h, const uint8_t *buf, int size) int ret; URLContext *hd; + if (size < 2) + return AVERROR(EINVAL); + if (RTP_PT_IS_RTCP(buf[1])) { /* RTCP payload type */ hd = s->rtcp_hd;