summaryrefslogtreecommitdiff
path: root/res/res_format_attr_h264.c
diff options
context:
space:
mode:
authorJoshua Colp <jcolp@digium.com>2012-09-24 14:27:17 +0000
committerJoshua Colp <jcolp@digium.com>2012-09-24 14:27:17 +0000
commitad3e51bf4c6709fdbe15afd1b440bddfa5db41cc (patch)
tree5603a0cc5fbd85c12ff84df7aa149e06ac20030f /res/res_format_attr_h264.c
parentf787f4219a26e5ab7ad93ffa1198e96dfd26fee6 (diff)
Fix an issue with H.264 format attribute comparison and fix an issue with improper SDP being produced.
The H.264 format attribute module compares two format attribute structures to determine if they are compatible or not. In some instances it was possible for this check to determine that both structures were incompatible when they actually should be considered compatible. This check has now been made even more permissive by assuming that if no attribute information is available the two structures are compatible. If both structures contain attribute information a base level comparison of the H.264 IDC value is done to see if they are compatible or not. The above issue uncovered a secondary issue in chan_sip where the SDP being produced would be incorrect if the formats were considered incompatible. This has now been fixed by checking that all information required to produce the SDP is available instead of assuming it is. (closes issue ASTERISK-20464) Reported by: Leif Madsen ........ Merged revisions 373413 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@373414 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'res/res_format_attr_h264.c')
-rw-r--r--res/res_format_attr_h264.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/res/res_format_attr_h264.c b/res/res_format_attr_h264.c
index 3b62b74c0..9642c51f1 100644
--- a/res/res_format_attr_h264.c
+++ b/res/res_format_attr_h264.c
@@ -74,11 +74,12 @@ enum h264_attr_keys {
static enum ast_format_cmp_res h264_format_attr_cmp(const struct ast_format_attr *fattr1, const struct ast_format_attr *fattr2)
{
- unsigned int idc1 = fattr1->format_attr[H264_ATTR_KEY_PROFILE_IDC] ? fattr1->format_attr[H264_ATTR_KEY_PROFILE_IDC] : 0x42;
- unsigned int idc2 = fattr2->format_attr[H264_ATTR_KEY_PROFILE_IDC] ? fattr2->format_attr[H264_ATTR_KEY_PROFILE_IDC] : 0x42;
+ if (!fattr1->format_attr[H264_ATTR_KEY_PROFILE_IDC] || !fattr2->format_attr[H264_ATTR_KEY_PROFILE_IDC] ||
+ (fattr1->format_attr[H264_ATTR_KEY_PROFILE_IDC] == fattr2->format_attr[H264_ATTR_KEY_PROFILE_IDC])) {
+ return AST_FORMAT_CMP_EQUAL;
+ }
- /* We are as permissive as possible to ensure the maximum number of calls succeed */
- return (idc1 == idc2) ? AST_FORMAT_CMP_EQUAL : AST_FORMAT_CMP_NOT_EQUAL;
+ return AST_FORMAT_CMP_NOT_EQUAL;
}
static int h264_format_attr_get_joint(const struct ast_format_attr *fattr1, const struct ast_format_attr *fattr2, struct ast_format_attr *result)