mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-03 11:25:35 +00:00
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
This commit is contained in:
@@ -1376,7 +1376,7 @@ static int load_module(void)
|
||||
struct ast_flags config_flags = { 0 };
|
||||
struct ast_format tmpfmt;
|
||||
|
||||
if (!(phone_tech.capabilities = ast_format_cap_alloc())) {
|
||||
if (!(phone_tech.capabilities = ast_format_cap_alloc(0))) {
|
||||
return AST_MODULE_LOAD_DECLINE;
|
||||
}
|
||||
ast_format_cap_add(phone_tech.capabilities, ast_format_set(&tmpfmt, AST_FORMAT_G723_1, 0));
|
||||
@@ -1384,11 +1384,11 @@ static int load_module(void)
|
||||
ast_format_cap_add(phone_tech.capabilities, ast_format_set(&tmpfmt, AST_FORMAT_ULAW, 0));
|
||||
ast_format_cap_add(phone_tech.capabilities, ast_format_set(&tmpfmt, AST_FORMAT_G729A, 0));
|
||||
|
||||
if (!(prefcap = ast_format_cap_alloc())) {
|
||||
if (!(prefcap = ast_format_cap_alloc(0))) {
|
||||
return AST_MODULE_LOAD_DECLINE;
|
||||
}
|
||||
ast_format_cap_copy(prefcap, phone_tech.capabilities);
|
||||
if (!(phone_tech_fxs.capabilities = ast_format_cap_alloc())) {
|
||||
if (!(phone_tech_fxs.capabilities = ast_format_cap_alloc(0))) {
|
||||
return AST_MODULE_LOAD_DECLINE;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user