Merge "format_cap: Don't append the 'none' format when appending all." into 13

This commit is contained in:
Matt Jordan
2015-11-12 10:54:04 -06:00
committed by Gerrit Code Review
2 changed files with 9 additions and 1 deletions

View File

@@ -265,7 +265,15 @@ int ast_format_cap_append_by_type(struct ast_format_cap *cap, enum ast_media_typ
}
format = ast_format_cache_get(codec->name);
if (format == ast_format_none) {
ao2_ref(format, -1);
ao2_ref(codec, -1);
continue;
}
if (!format || (codec != ast_format_get_codec(format))) {
ao2_cleanup(format);
format = ast_format_create(codec);
}
ao2_ref(codec, -1);

View File

@@ -245,7 +245,7 @@ AST_TEST_DEFINE(format_cap_append_all_unknown)
} else if (!ast_format_cap_has_type(caps, AST_MEDIA_TYPE_VIDEO)) {
ast_test_status_update(test, "Added all media formats but no video formats exist when they should\n");
return AST_TEST_FAIL;
} else if ((ast_format_cap_count(caps) + 1) != ast_codec_get_max()) {
} else if ((ast_format_cap_count(caps) + 1) != (ast_codec_get_max() - 1)) {
ast_test_status_update(test, "The number of formats in the capabilities structure does not match known number\n");
return AST_TEST_FAIL;
}