summaryrefslogtreecommitdiff
path: root/addons
diff options
context:
space:
mode:
authorMark Michelson <mmichelson@digium.com>2013-10-03 14:58:16 +0000
committerMark Michelson <mmichelson@digium.com>2013-10-03 14:58:16 +0000
commitee21eee7e067573ad83bd0df492036094b4dbaca (patch)
tree024e25a92079bc7e5348bd55cc29eff2f3c38dec /addons
parentc977f73e136eca1f2aaccd0ea0fe45c350906374 (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 'addons')
-rw-r--r--addons/chan_mobile.c2
-rw-r--r--addons/chan_ooh323.c10
2 files changed, 6 insertions, 6 deletions
diff --git a/addons/chan_mobile.c b/addons/chan_mobile.c
index f5d5b4e1a..2cf7c7dbd 100644
--- a/addons/chan_mobile.c
+++ b/addons/chan_mobile.c
@@ -4705,7 +4705,7 @@ static int load_module(void)
int dev_id, s;
- if (!(mbl_tech.capabilities = ast_format_cap_alloc())) {
+ if (!(mbl_tech.capabilities = ast_format_cap_alloc(0))) {
return AST_MODULE_LOAD_DECLINE;
}
ast_format_set(&prefformat, DEVICE_FRAME_FORMAT, 0);
diff --git a/addons/chan_ooh323.c b/addons/chan_ooh323.c
index 303b06857..f374a216b 100644
--- a/addons/chan_ooh323.c
+++ b/addons/chan_ooh323.c
@@ -521,7 +521,7 @@ static struct ooh323_pvt *ooh323_alloc(int callref, char *callToken)
ast_log(LOG_ERROR, "Couldn't allocate private ooh323 structure\n");
return NULL;
}
- if (!(pvt->cap = ast_format_cap_alloc_nolock())) {
+ if (!(pvt->cap = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_NOLOCK))) {
ast_free(pvt);
ast_log(LOG_ERROR, "Couldn't allocate private ooh323 structure\n");
return NULL;
@@ -2304,7 +2304,7 @@ static struct ooh323_user *build_user(const char *name, struct ast_variable *v)
user = ast_calloc(1,sizeof(struct ooh323_user));
if (user) {
memset(user, 0, sizeof(struct ooh323_user));
- if (!(user->cap = ast_format_cap_alloc())) {
+ if (!(user->cap = ast_format_cap_alloc(0))) {
ast_free(user);
return NULL;
}
@@ -2452,7 +2452,7 @@ static struct ooh323_peer *build_peer(const char *name, struct ast_variable *v,
peer = ast_calloc(1, sizeof(*peer));
if (peer) {
memset(peer, 0, sizeof(struct ooh323_peer));
- if (!(peer->cap = ast_format_cap_alloc())) {
+ if (!(peer->cap = ast_format_cap_alloc(0))) {
ast_free(peer);
return NULL;
}
@@ -3677,10 +3677,10 @@ static int load_module(void)
.onModeChanged = onModeChanged,
.onMediaChanged = (cb_OnMediaChanged) setup_rtp_remote,
};
- if (!(gCap = ast_format_cap_alloc())) {
+ if (!(gCap = ast_format_cap_alloc(0))) {
return 1;
}
- if (!(ooh323_tech.capabilities = ast_format_cap_alloc())) {
+ if (!(ooh323_tech.capabilities = ast_format_cap_alloc(0))) {
return 1;
}
ast_format_cap_add(gCap, ast_format_set(&tmpfmt, AST_FORMAT_ULAW, 0));