diff mbox series

[FFmpeg-devel,1/1] libavformat/rtsp.c: Reply to GET_PARAMETER requests

Message ID BLAPR10MB5169BC217DCB2F8E17E0C497A3069@BLAPR10MB5169.namprd10.prod.outlook.com
State Accepted
Headers show
Series [FFmpeg-devel,1/1] libavformat/rtsp.c: Reply to GET_PARAMETER requests | expand

Checks

Context Check Description
andriy/configure warning Failed to apply patch

Commit Message

Hayden Myers June 25, 2021, 9:58 p.m. UTC
Some encoders send GET_PARAMETER requests as a keep-alive mechanism.
If the client doesn't reply with an OK message, the encoder will close
the session.  This was encountered with the impath i5110 encoder, when
the RTSP Keep-Alive checkbox is enabled under streaming settings.
Alternatively one may set the X-No-Keepalive: 1 header, but this is more
of a workaround.  It's better practice to respond to an encoder's
keep-alive request, than disable the mechanism which may be manufacturer
specific.

Signed-off-by: Hayden Myers <hmyers@skylinenet.net>
---
 libavformat/rtsp.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

--
2.20.1
Hayden Myers
Principal Software Engineer
t: (410) 590-2027

Comments

Martin Storsjö June 25, 2021, 10:17 p.m. UTC | #1
On Fri, 25 Jun 2021, Hayden Myers wrote:

> Some encoders send GET_PARAMETER requests as a keep-alive mechanism.
> If the client doesn't reply with an OK message, the encoder will close
> the session.  This was encountered with the impath i5110 encoder, when
> the RTSP Keep-Alive checkbox is enabled under streaming settings.
> Alternatively one may set the X-No-Keepalive: 1 header, but this is more
> of a workaround.  It's better practice to respond to an encoder's
> keep-alive request, than disable the mechanism which may be manufacturer
> specific.
>
> Signed-off-by: Hayden Myers <hmyers@skylinenet.net>
> ---
>  libavformat/rtsp.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
> index 9f509a229f..dc660368f0 100644
> --- a/libavformat/rtsp.c
> +++ b/libavformat/rtsp.c
> @@ -1259,7 +1259,9 @@ start:
>          char base64buf[AV_BASE64_SIZE(sizeof(buf))];
>          const char* ptr = buf;
>
> -        if (!strcmp(reply->reason, "OPTIONS")) {
> +        if (!strcmp(reply->reason, "OPTIONS") ||
> +            !strcmp(reply->reason, "GET_PARAMETER")) {
> +
>              snprintf(buf, sizeof(buf), "RTSP/1.0 200 OK\r\n");
>              if (reply->seq)
>                  av_strlcatf(buf, sizeof(buf), "CSeq: %d\r\n", reply->seq);
> --

LGTM, this sounds and seems reasonable to me (although untested in 
practice).

// Martin
diff mbox series

Patch

diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
index 9f509a229f..dc660368f0 100644
--- a/libavformat/rtsp.c
+++ b/libavformat/rtsp.c
@@ -1259,7 +1259,9 @@  start:
         char base64buf[AV_BASE64_SIZE(sizeof(buf))];
         const char* ptr = buf;

-        if (!strcmp(reply->reason, "OPTIONS")) {
+        if (!strcmp(reply->reason, "OPTIONS") ||
+            !strcmp(reply->reason, "GET_PARAMETER")) {
+
             snprintf(buf, sizeof(buf), "RTSP/1.0 200 OK\r\n");
             if (reply->seq)
                 av_strlcatf(buf, sizeof(buf), "CSeq: %d\r\n", reply->seq);