res_format_attr_*: Parameter Names are Case-Insensitive.

see RFC 4855:
parameter names are case-insensitive both in media type strings and
in the default mapping to the SDP a=fmtp attribute.

This change is required for H.263+ because some implementations are
known to use even mixed-case. This does not fix ASTERISK~29268 because
H.264 was not fixed. This approach here lowers/uppers both parameter
names and parameter values. H.264 needs a different approach because
one of its parameter values is not case-insensitive:
sprop-parameter-sets is Base64.

Change-Id: Idf2a73457be231647aed3c87b1da197afba86892
This commit is contained in:
Alexander Traud
2021-03-05 18:16:56 +01:00
committed by Joshua Colp
parent 8c461845c8
commit 1ae40e502d
8 changed files with 100 additions and 21 deletions

View File

@@ -33,8 +33,12 @@
#include "asterisk.h"
#include <ctype.h> /* for toupper */
#include "asterisk/module.h"
#include "asterisk/format.h"
#include "asterisk/strings.h" /* for ast_str_append */
#include "asterisk/utils.h" /* for ast_strip */
/*! \brief Value that indicates an attribute is actually unset */
#define H263_ATTR_KEY_UNSET UINT8_MAX
@@ -174,6 +178,11 @@ static struct ast_format *h263_parse_sdp_fmtp(const struct ast_format *format, c
}
attr = ast_format_get_attribute_data(cloned);
/* upper-case everything, so we are case-insensitive */
for (attrib = attribs; *attrib; ++attrib) {
*attrib = toupper(*attrib);
} /* based on channels/chan_sip.c:process_a_sdp_image() */
attr->BPP = H263_ATTR_KEY_UNSET;
attr->MaxBR = H263_ATTR_KEY_UNSET;
attr->PAR_WIDTH = H263_ATTR_KEY_UNSET;