[FFmpeg-devel] [PATCH] avformat/rtsp: don't overwrite session control uri

Andriy Gelman andriy.gelman at gmail.com
Mon Jan 18 02:55:56 EET 2021


On Mon, 18. Jan 00:49, Carl Eugen Hoyos wrote:
> Am So., 11. Okt. 2020 um 01:54 Uhr schrieb Andriy Gelman
> <andriy.gelman at gmail.com>:
> >
> > From: Andriy Gelman <andriy.gelman at gmail.com>
> >
> > Fixes #1941
> >
> > Currently the session control uri gets overwritten by the media's uri
> > when mpegts is signalled in the media description. This happens because
> > s->nb_streams doesn't count mpegts which is instead part of the private
> > context in RTSPStream.
> >
> > Instead use rt->nb_rtsp_streams which counts all of the media streams
> > signalled in the sdp.
> >
> > This solution was originally proposed by user "tpol" on trac:
> > https://trac.ffmpeg.org/ticket/1941
> >
> > Signed-off-by: Andriy Gelman <andriy.gelman at gmail.com>
> > ---
> >  libavformat/rtsp.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
> > index e9fca034b4..4d5459ac41 100644
> > --- a/libavformat/rtsp.c
> > +++ b/libavformat/rtsp.c
> > @@ -542,7 +542,7 @@ static void sdp_parse_line(AVFormatContext *s, SDPParseState *s1,
> >          break;
> >      case 'a':
> >          if (av_strstart(p, "control:", &p)) {
> > -            if (s->nb_streams == 0) {
> > +            if (rt->nb_rtsp_streams == 0) {
> >                  if (!strncmp(p, "rtsp://", 7))
> >                      av_strlcpy(rt->control_uri, p,
> >                                 sizeof(rt->control_uri));

> 
> Wasn't this patch written by tpol?

I did say in the commit message that it was proposed by tpol from trac.
Afaik the patch wasn't sent to the ML, so there's no email for author.

What do you suggest?

btw the updated first part of the commit message is:

"Currently the session control uri gets overwritten by the media's uri
when mpegts is signalled in the media description. This happens because
s->nb_streams doesn't count mpegts (AVStreams are added when parsing
mpegts packets). Instead use rt->nb_rtsp_streams, which also counts
mpegts."

-- 
Andriy


More information about the ffmpeg-devel mailing list