You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-15 14:13:16 +02:00
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>
This commit is contained in:
committed by
Michael Niedermayer
parent
86db71b402
commit
6f5048f4a0
@@ -323,6 +323,7 @@ static int rtp_open(URLContext *h, const char *uri, int flags)
|
|||||||
char path[1024];
|
char path[1024];
|
||||||
const char *p;
|
const char *p;
|
||||||
int i, max_retry_count = 3;
|
int i, max_retry_count = 3;
|
||||||
|
int rtcpflags;
|
||||||
|
|
||||||
av_url_split(NULL, 0, NULL, 0, hostname, sizeof(hostname), &rtp_port,
|
av_url_split(NULL, 0, NULL, 0, hostname, sizeof(hostname), &rtp_port,
|
||||||
path, sizeof(path), uri);
|
path, sizeof(path), uri);
|
||||||
@@ -388,12 +389,13 @@ static int rtp_open(URLContext *h, const char *uri, int flags)
|
|||||||
s->local_rtpport = -1;
|
s->local_rtpport = -1;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
rtcpflags = flags | AVIO_FLAG_WRITE;
|
||||||
if (s->local_rtcpport < 0) {
|
if (s->local_rtcpport < 0) {
|
||||||
s->local_rtcpport = s->local_rtpport + 1;
|
s->local_rtcpport = s->local_rtpport + 1;
|
||||||
build_udp_url(s, buf, sizeof(buf),
|
build_udp_url(s, buf, sizeof(buf),
|
||||||
hostname, s->rtcp_port, s->local_rtcpport,
|
hostname, s->rtcp_port, s->local_rtcpport,
|
||||||
sources, block);
|
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->interrupt_callback, NULL,
|
||||||
h->protocol_whitelist, h->protocol_blacklist) < 0) {
|
h->protocol_whitelist, h->protocol_blacklist) < 0) {
|
||||||
s->local_rtpport = s->local_rtcpport = -1;
|
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),
|
build_udp_url(s, buf, sizeof(buf),
|
||||||
hostname, s->rtcp_port, s->local_rtcpport,
|
hostname, s->rtcp_port, s->local_rtcpport,
|
||||||
sources, block);
|
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)
|
NULL, h->protocol_whitelist, h->protocol_blacklist) < 0)
|
||||||
goto fail;
|
goto fail;
|
||||||
break;
|
break;
|
||||||
|
@@ -2316,7 +2316,7 @@ static int sdp_read_header(AVFormatContext *s)
|
|||||||
append_source_addrs(url, sizeof(url), "block",
|
append_source_addrs(url, sizeof(url), "block",
|
||||||
rtsp_st->nb_exclude_source_addrs,
|
rtsp_st->nb_exclude_source_addrs,
|
||||||
rtsp_st->exclude_source_addrs);
|
rtsp_st->exclude_source_addrs);
|
||||||
err = ffurl_open_whitelist(&rtsp_st->rtp_handle, url, AVIO_FLAG_READ_WRITE,
|
err = ffurl_open_whitelist(&rtsp_st->rtp_handle, url, AVIO_FLAG_READ,
|
||||||
&s->interrupt_callback, &opts, s->protocol_whitelist, s->protocol_blacklist);
|
&s->interrupt_callback, &opts, s->protocol_whitelist, s->protocol_blacklist);
|
||||||
|
|
||||||
av_dict_free(&opts);
|
av_dict_free(&opts);
|
||||||
|
Reference in New Issue
Block a user