mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-04 03:50:31 +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
4fc0e16838
commit
262473c6d9
@@ -31,6 +31,8 @@
|
||||
|
||||
#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 */
|
||||
@@ -76,6 +78,7 @@ static int vp8_clone(const struct ast_format *src, struct ast_format *dst)
|
||||
|
||||
static struct ast_format *vp8_parse_sdp_fmtp(const struct ast_format *format, const char *attributes)
|
||||
{
|
||||
char *attribs = ast_strdupa(attributes), *attrib;
|
||||
struct ast_format *cloned;
|
||||
struct vp8_attr *attr;
|
||||
const char *kvp;
|
||||
@@ -87,13 +90,18 @@ static struct ast_format *vp8_parse_sdp_fmtp(const struct ast_format *format, co
|
||||
}
|
||||
attr = ast_format_get_attribute_data(cloned);
|
||||
|
||||
if ((kvp = strstr(attributes, "max-fr")) && sscanf(kvp, "max-fr=%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 ((kvp = strstr(attribs, "max-fr")) && sscanf(kvp, "max-fr=%30u", &val) == 1) {
|
||||
attr->maximum_frame_rate = val;
|
||||
} else {
|
||||
attr->maximum_frame_rate = UINT_MAX;
|
||||
}
|
||||
|
||||
if ((kvp = strstr(attributes, "max-fs")) && sscanf(kvp, "max-fs=%30u", &val) == 1) {
|
||||
if ((kvp = strstr(attribs, "max-fs")) && sscanf(kvp, "max-fs=%30u", &val) == 1) {
|
||||
attr->maximum_frame_size = val;
|
||||
} else {
|
||||
attr->maximum_frame_size = UINT_MAX;
|
||||
|
Reference in New Issue
Block a user