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

Martin Storsjö martin at martin.st
Mon Jul 12 16:21:35 EEST 2021


On Sat, 26 Jun 2021, Martin Storsjö wrote:

> 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 at 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).

Pushed this patch now. Do note that the patch was badly mangled (the extra 
PNG attachments I think?) which made git unable to automatically apply it 
from the mail message, so I had to retype the patch manually.

// Martin


More information about the ffmpeg-devel mailing list