diff options
author | Mark Michelson <mmichelson@digium.com> | 2013-10-03 14:58:16 +0000 |
---|---|---|
committer | Mark Michelson <mmichelson@digium.com> | 2013-10-03 14:58:16 +0000 |
commit | ee21eee7e067573ad83bd0df492036094b4dbaca (patch) | |
tree | 024e25a92079bc7e5348bd55cc29eff2f3c38dec /apps/app_confbridge.c | |
parent | c977f73e136eca1f2aaccd0ea0fe45c350906374 (diff) |
Cache string values of formats on ast_format_cap() to save processing.
Channel snapshots have string representations of the channel's native formats.
Prior to this change, the format strings were re-created on ever channel snapshot
creation. Since channel native formats rarely change, this was very wasteful.
Now, string representations of formats may optionally be stored on the ast_format_cap
for cases where string representations may be requested frequently. When formats
are altered, the string cache is marked as invalid. When strings are requested, the
cache validity is checked. If the cache is valid, then the cached strings are copied.
If the cache is invalid, then the string cache is rebuilt and copied, and the cache
is marked as being valid again.
Review: https://reviewboard.asterisk.org/r/2879
........
Merged revisions 400356 from http://svn.asterisk.org/svn/asterisk/branches/12
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@400363 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'apps/app_confbridge.c')
-rw-r--r-- | apps/app_confbridge.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/apps/app_confbridge.c b/apps/app_confbridge.c index d9db7ab5b..47cfa0b8b 100644 --- a/apps/app_confbridge.c +++ b/apps/app_confbridge.c @@ -662,7 +662,7 @@ static int conf_start_record(struct confbridge_conference *conference) return -1; } - cap = ast_format_cap_alloc_nolock(); + cap = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_NOLOCK); if (!cap) { return -1; } @@ -1327,7 +1327,7 @@ static int alloc_playback_chan(struct confbridge_conference *conference) struct ast_format_cap *cap; struct ast_format format; - cap = ast_format_cap_alloc_nolock(); + cap = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_NOLOCK); if (!cap) { return -1; } @@ -3094,7 +3094,7 @@ static void unregister_channel_tech(struct ast_channel_tech *tech) */ static int register_channel_tech(struct ast_channel_tech *tech) { - tech->capabilities = ast_format_cap_alloc(); + tech->capabilities = ast_format_cap_alloc(0); if (!tech->capabilities) { return -1; } |