Sorry, I work hard to cross the Great Fire Wall to send this patch and cannot send it as plaintext. Now send it as attachment.
On Fri, Jan 8, 2016 at 1:52 AM, Michael Niedermayer <mich...@niedermayer.cc> wrote: > On Thu, Jan 07, 2016 at 06:58:49PM +0800, Zhao Zhili wrote: > > I made a mistake that rtp and rtcp cannot be the same port. A new patch > is > > appended. > > > > From: Zhao Zhili <wantl...@gmail.com> > > Date: Thu, 7 Jan 2016 18:55:50 +0800 > > Subject: [PATCH] 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 <wantl...@gmail.com> > > --- > > libavformat/rtpproto.c | 6 ++++-- > > libavformat/rtsp.c | 2 +- > > 2 files changed, 5 insertions(+), 3 deletions(-) > > > > diff --git a/libavformat/rtpproto.c b/libavformat/rtpproto.c > > index e0aa23e..04a40ea 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); > > @@ -387,12 +388,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(&s->rtcp_hd, buf, flags, > > &h->interrupt_callback, NULL) < 0) { > > + if (ffurl_open(&s->rtcp_hd, buf, rtcpflags, > > &h->interrupt_callback, NULL) < 0) { > > the patch is corrupted by linebreaks > > attaching it usually fixes that > > [...] > -- > Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB > > Old school: Use the lowest level language in which you can solve the > problem > conveniently. > New school: Use the highest level language in which the latest > supercomputer > can solve the problem without the user falling asleep waiting. > > _______________________________________________ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel > >
From 600d1509678dcb464de1008d27a3bf2b2a32cde1 Mon Sep 17 00:00:00 2001 From: Zhao Zhili <wantl...@gmail.com> Date: Thu, 7 Jan 2016 18:55:50 +0800 Subject: [PATCH] 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 <wantl...@gmail.com> --- libavformat/rtpproto.c | 6 ++++-- libavformat/rtsp.c | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/libavformat/rtpproto.c b/libavformat/rtpproto.c index e0aa23e..04a40ea 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); @@ -387,12 +388,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(&s->rtcp_hd, buf, flags, &h->interrupt_callback, NULL) < 0) { + if (ffurl_open(&s->rtcp_hd, buf, rtcpflags, &h->interrupt_callback, NULL) < 0) { s->local_rtpport = s->local_rtcpport = -1; continue; } @@ -401,7 +403,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(&s->rtcp_hd, buf, flags, &h->interrupt_callback, NULL) < 0) + if (ffurl_open(&s->rtcp_hd, buf, rtcpflags, &h->interrupt_callback, NULL) < 0) goto fail; break; } diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c index 39539e9..8cae376 100644 --- a/libavformat/rtsp.c +++ b/libavformat/rtsp.c @@ -2316,7 +2316,7 @@ static int sdp_read_header(AVFormatContext *s) append_source_addrs(url, sizeof(url), "block", rtsp_st->nb_exclude_source_addrs, rtsp_st->exclude_source_addrs); - err = ffurl_open(&rtsp_st->rtp_handle, url, AVIO_FLAG_READ_WRITE, + err = ffurl_open(&rtsp_st->rtp_handle, url, AVIO_FLAG_READ, &s->interrupt_callback, &opts); av_dict_free(&opts); -- 1.9.1
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel