mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-12 15:45:18 +00:00
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:
committed by
Joshua Colp
parent
8c461845c8
commit
1ae40e502d
@@ -29,8 +29,13 @@
|
||||
|
||||
#include "asterisk.h"
|
||||
|
||||
#include <ctype.h> /* for tolower */
|
||||
|
||||
#include "asterisk/module.h"
|
||||
#include "asterisk/format.h"
|
||||
#include "asterisk/logger.h" /* for ast_log, LOG_WARNING */
|
||||
#include "asterisk/strings.h" /* for ast_str_append */
|
||||
#include "asterisk/utils.h" /* for MAX, MIN */
|
||||
|
||||
/*!
|
||||
* \brief SILK attribute structure.
|
||||
@@ -78,6 +83,7 @@ static int silk_clone(const struct ast_format *src, struct ast_format *dst)
|
||||
|
||||
static struct ast_format *silk_parse_sdp_fmtp(const struct ast_format *format, const char *attributes)
|
||||
{
|
||||
char *attribs = ast_strdupa(attributes), *attrib;
|
||||
struct ast_format *cloned;
|
||||
struct silk_attr *attr;
|
||||
unsigned int val;
|
||||
@@ -88,13 +94,18 @@ static struct ast_format *silk_parse_sdp_fmtp(const struct ast_format *format, c
|
||||
}
|
||||
attr = ast_format_get_attribute_data(cloned);
|
||||
|
||||
if (sscanf(attributes, "maxaveragebitrate=%30u", &val) == 1) {
|
||||
/* lower-case everything, so we are case-insensitive */
|
||||
for (attrib = attribs; *attrib; ++attrib) {
|
||||
*attrib = tolower(*attrib);
|
||||
} /* based on channels/chan_sip.c:process_a_sdp_image() */
|
||||
|
||||
if (sscanf(attribs, "maxaveragebitrate=%30u", &val) == 1) {
|
||||
attr->maxbitrate = val;
|
||||
}
|
||||
if (sscanf(attributes, "usedtx=%30u", &val) == 1) {
|
||||
if (sscanf(attribs, "usedtx=%30u", &val) == 1) {
|
||||
attr->dtx = val;
|
||||
}
|
||||
if (sscanf(attributes, "useinbandfec=%30u", &val) == 1) {
|
||||
if (sscanf(attribs, "useinbandfec=%30u", &val) == 1) {
|
||||
attr->fec = val;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user