From 156ceeded6cd076b781205adc034144186a9a7ea Mon Sep 17 00:00:00 2001 From: Paul Orlyk 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. Signed-off-by: Paul Orlyk --- 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; rtsp_st->interleaved_max = request.transports[0].interleaved_max; snprintf(responseheaders, sizeof(responseheaders), "Transport: " - "RTP/AVP/TCP;unicast;mode=receive;interleaved=%d-%d" + "RTP/AVP/TCP;unicast;mode=record;interleaved=%d-%d" "\r\n", request.transports[0].interleaved_min, request.transports[0].interleaved_max); } else { @@ -333,7 +333,7 @@ static int rtsp_read_setup(AVFormatContext *s, char* host, char *controlurl) localport = ff_rtp_get_local_rtp_port(rtsp_st->rtp_handle); snprintf(responseheaders, sizeof(responseheaders), "Transport: " - "RTP/AVP/UDP;unicast;mode=receive;source=%s;" + "RTP/AVP/UDP;unicast;mode=record;source=%s;" "client_port=%d-%d;server_port=%d-%d\r\n", host, request.transports[0].client_port_min, request.transports[0].client_port_max, localport, -- 2.39.2