diff options
author | Mark Michelson <mmichelson@digium.com> | 2014-09-18 16:37:47 +0000 |
---|---|---|
committer | Mark Michelson <mmichelson@digium.com> | 2014-09-18 16:37:47 +0000 |
commit | 23a375be5f27e5418b47d06a577b663dca5e62bc (patch) | |
tree | 082cebd4311a4d80054fc38d2c2bc62171695fba /main/translate.c | |
parent | 5c5aee445879016765f2205015cd33b62175f9c6 (diff) |
Add API call to determine if format capability structure is "empty".
Empty here means that there are no formats in the format_cap structure
or the only format in it is the "none" format.
I've added calls to check the emptiness of a format_cap in a few places
in order to short-circuit operations that would otherwise be pointless
as well as to prevent some assertions from being triggered in cases
where channels with no formats are used.
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@423414 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main/translate.c')
-rw-r--r-- | main/translate.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/main/translate.c b/main/translate.c index 0696f5d83..2778ebccf 100644 --- a/main/translate.c +++ b/main/translate.c @@ -1276,6 +1276,11 @@ int ast_translator_best_choice(struct ast_format_cap *dst_cap, int i; int j; + if (ast_format_cap_empty(dst_cap) || ast_format_cap_empty(src_cap)) { + ast_log(LOG_ERROR, "Cannot determine best translation path since one capability supports no formats\n"); + return -1; + } + if (!(joint_cap = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_DEFAULT))) { return -1; } |