summaryrefslogtreecommitdiff
path: root/libavformat/rtpproto.c
diff options
context:
space:
mode:
authorZhao Zhili <wantlamy@gmail.com>2016-01-07 18:55:50 +0800
committerMichael Niedermayer <michael@niedermayer.cc>2016-03-07 02:29:41 +0100
commit6f5048f4a0f702d92794dda7752c20ed6033233b (patch)
treea7f89140d9ed8cf9897aeb820ab6c78751c5160e /libavformat/rtpproto.c
parent86db71b402e9f6b5782e1110ece4cb35c525d4b0 (diff)
rtp: Fix play multiple multicast streams with the same port
We cannot play multiple multicast streams with the same port at the same time. This is because both rtp and rtcp port are opened in read-write mode, so they will not bind to the multicast address. Try to make rtp port as read-only by default to solve this bug. Signed-off-by: Zhao Zhili <wantlamy@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavformat/rtpproto.c')
-rw-r--r--libavformat/rtpproto.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/libavformat/rtpproto.c b/libavformat/rtpproto.c
index 451d8114e5..2062083aee 100644
--- a/libavformat/rtpproto.c
+++ b/libavformat/rtpproto.c
@@ -323,6 +323,7 @@ static int rtp_open(URLContext *h, const char *uri, int flags)
char path[1024];
const char *p;
int i, max_retry_count = 3;
+ int rtcpflags;
av_url_split(NULL, 0, NULL, 0, hostname, sizeof(hostname), &rtp_port,
path, sizeof(path), uri);
@@ -388,12 +389,13 @@ static int rtp_open(URLContext *h, const char *uri, int flags)
s->local_rtpport = -1;
continue;
}
+ rtcpflags = flags | AVIO_FLAG_WRITE;
if (s->local_rtcpport < 0) {
s->local_rtcpport = s->local_rtpport + 1;
build_udp_url(s, buf, sizeof(buf),
hostname, s->rtcp_port, s->local_rtcpport,
sources, block);
- if (ffurl_open_whitelist(&s->rtcp_hd, buf, flags,
+ if (ffurl_open_whitelist(&s->rtcp_hd, buf, rtcpflags,
&h->interrupt_callback, NULL,
h->protocol_whitelist, h->protocol_blacklist) < 0) {
s->local_rtpport = s->local_rtcpport = -1;
@@ -404,7 +406,7 @@ static int rtp_open(URLContext *h, const char *uri, int flags)
build_udp_url(s, buf, sizeof(buf),
hostname, s->rtcp_port, s->local_rtcpport,
sources, block);
- if (ffurl_open_whitelist(&s->rtcp_hd, buf, flags, &h->interrupt_callback,
+ if (ffurl_open_whitelist(&s->rtcp_hd, buf, rtcpflags, &h->interrupt_callback,
NULL, h->protocol_whitelist, h->protocol_blacklist) < 0)
goto fail;
break;