[FFmpeg-devel] [PATCH] avformat/rtsp: Fix server compatibility issues with rtspclientsink GStreamer plugin

Michael Niedermayer michael at niedermayer.cc
Sat Jan 13 20:22:18 EET 2024


On Fri, Jan 12, 2024 at 10:46:41PM +0200, Paul Orlyk wrote:
> On 1/12/24 21:07, Michael Niedermayer wrote:
> > On Wed, Jan 03, 2024 at 02:51:36PM +0200, Paul Orlyk wrote:
> > > On 12/28/23 21:33, Michael Niedermayer wrote:
> > > > On Wed, Dec 27, 2023 at 03:44:09PM +0200, Paul Orlyk wrote:
> > > > > mode field in Transport header can be sent in upper case so make string
> > > > > comparison case insensitive.
> > > > > Also, GStreamer expects to see mode=record instead of mode=receive in
> > > > > Transport header in response.
> > > > > 
> > > > > Signed-off-by: Paul Orlyk<paul.orlyk at gmail.com>
> > > > > ---
> > > > >    libavformat/rtsp.c    | 4 ++--
> > > > >    libavformat/rtspdec.c | 4 ++--
> > > > >    2 files changed, 4 insertions(+), 4 deletions(-)
> > > > > 
> > > > > diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
> > > > > index 583f5338e8..61e24a5c7a 100644
> > > > > --- a/libavformat/rtsp.c
> > > > > +++ b/libavformat/rtsp.c
> > > > > @@ -1012,8 +1012,8 @@ static void rtsp_parse_transport(AVFormatContext *s,
> > > > >                    if (*p == '=') {
> > > > >                        p++;
> > > > >                        get_word_sep(buf, sizeof(buf), ";, ", &p);
> > > > > -                    if (!strcmp(buf, "record") ||
> > > > > -                        !strcmp(buf, "receive"))
> > > > > +                    if (!av_strcasecmp(buf, "record") ||
> > > > > +                        !av_strcasecmp(buf, "receive"))
> > > > >                            th->mode_record = 1;
> > > > >                    }
> > > > >                }
> > > > > diff --git a/libavformat/rtspdec.c b/libavformat/rtspdec.c
> > > > > index 39fd92fb66..d6a223cbc6 100644
> > > > > --- a/libavformat/rtspdec.c
> > > > > +++ b/libavformat/rtspdec.c
> > > > > @@ -303,7 +303,7 @@ static int rtsp_read_setup(AVFormatContext*s, char*
> > > > > host, char *controlurl)
> > > > >            rtsp_st->interleaved_min = request.transports[0].interleaved_min;
> > > > patch is damaged by linebreaks
> > > > 
> > > > 
> > > > [...]
> > > 
> > > 
> > > Sorry for that. Please find it attached.
> > 
> > >   rtsp.c    |    4 ++--
> > >   rtspdec.c |    4 ++--
> > >   2 files changed, 4 insertions(+), 4 deletions(-)
> > > 8ed5709b8c5cb30aeaa18d609b86b9be0557a06e  0001-avformat-rtsp-Fix-server-compatibility-issues-with-r.patch
> > >  From 156ceeded6cd076b781205adc034144186a9a7ea Mon Sep 17 00:00:00 2001
> > > From: Paul Orlyk <paul.orlyk at gmail.com>
> > > Date: Wed, 27 Dec 2023 15:30:20 +0200
> > > Subject: [PATCH] avformat/rtsp: Fix server compatibility issues with
> > >   rtspclientsink GStreamer plugin
> > > 
> > > mode field in Transport header can be sent in upper case so make string comparison case insensitive.
> > 
> > > Also, GStreamer expects to see mode=record instead of mode=receive in Transport header in response.
> > 
> > It appears to me that these are 2 seperate issues ?
> > if its 2 patches, i can apply the av_strcasecmp().
> 
> Essentially they are. I combined them in the context of GStreamer compatibility.
> Would it be better at this point to send them separately?

yes


> 
> > 
> > For the receive vs record i would prefer to see some quote from a RFC instead
> > of just an implementation
> > 
> > thx
> > 
> > [...]
> 
> Regarding receive vs record:
> 
> RFC 7826 "Real-Time Streaming Protocol Version 2.0" (https://datatracker.ietf.org/doc/html/rfc7826), section 18.54:
>    mode: The mode parameter indicates the methods to be supported for
>          this session.  The currently defined valid value is "PLAY".  If
>          not provided, the default is "PLAY".  The "RECORD" value was
>          defined in RFC 2326; in this specification, it is unspecified
>          but reserved.  RECORD and other values may be specified in the
>          future.
> RFC 2326 "Real Time Streaming Protocol (RTSP)" (https://datatracker.ietf.org/doc/html/rfc2326), section 12.39:
>    mode:
>           The mode parameter indicates the methods to be supported for
>           this session. Valid values are PLAY and RECORD. If not
>           provided, the default is PLAY.

Please add this to teh commit message
also if you can test with anything else than gstreamer, that would be great
rtsp/rtp is often regarded as a bit picky.
Reason why iam hesitant with applying patches on this, is i am affraid fixing
it in one case could break another

also if you can check git blame, why it was wrong, and add this too to
the commit message (like this was always this way or it is a regression since)
that also adds information.

thx
[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

If the United States is serious about tackling the national security threats 
related to an insecure 5G network, it needs to rethink the extent to which it
values corporate profits and government espionage over security.-Bruce Schneier
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20240113/f1c222ad/attachment.sig>


More information about the ffmpeg-devel mailing list