[svn-commits] mmichelson: branch 12 r400356 - in /branches/12: addons/ apps/ bridges/ chann...
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Wed Oct 2 17:34:14 CDT 2013
Author: mmichelson
Date: Wed Oct 2 17:34:05 2013
New Revision: 400356
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=400356
Log:
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
Modified:
branches/12/addons/chan_mobile.c
branches/12/addons/chan_ooh323.c
branches/12/apps/app_confbridge.c
branches/12/apps/app_meetme.c
branches/12/apps/app_originate.c
branches/12/bridges/bridge_holding.c
branches/12/bridges/bridge_native_rtp.c
branches/12/bridges/bridge_simple.c
branches/12/bridges/bridge_softmix.c
branches/12/channels/chan_alsa.c
branches/12/channels/chan_bridge_media.c
branches/12/channels/chan_console.c
branches/12/channels/chan_dahdi.c
branches/12/channels/chan_gtalk.c
branches/12/channels/chan_h323.c
branches/12/channels/chan_iax2.c
branches/12/channels/chan_jingle.c
branches/12/channels/chan_mgcp.c
branches/12/channels/chan_misdn.c
branches/12/channels/chan_motif.c
branches/12/channels/chan_multicast_rtp.c
branches/12/channels/chan_nbs.c
branches/12/channels/chan_oss.c
branches/12/channels/chan_phone.c
branches/12/channels/chan_pjsip.c
branches/12/channels/chan_sip.c
branches/12/channels/chan_skinny.c
branches/12/channels/chan_unistim.c
branches/12/channels/dahdi/bridge_native_dahdi.c
branches/12/include/asterisk/format_cap.h
branches/12/main/bridge_basic.c
branches/12/main/ccss.c
branches/12/main/channel.c
branches/12/main/core_local.c
branches/12/main/dial.c
branches/12/main/file.c
branches/12/main/format_cap.c
branches/12/main/manager.c
branches/12/main/media_index.c
branches/12/main/rtp_engine.c
branches/12/pbx/pbx_spool.c
branches/12/res/ari/resource_bridges.c
branches/12/res/parking/parking_applications.c
branches/12/res/res_agi.c
branches/12/res/res_clioriginate.c
branches/12/res/res_pjsip/pjsip_configuration.c
branches/12/res/res_pjsip_sdp_rtp.c
branches/12/res/res_pjsip_session.c
branches/12/res/res_stasis.c
branches/12/tests/test_config.c
branches/12/tests/test_format_api.c
Modified: branches/12/addons/chan_mobile.c
URL: http://svnview.digium.com/svn/asterisk/branches/12/addons/chan_mobile.c?view=diff&rev=400356&r1=400355&r2=400356
==============================================================================
--- branches/12/addons/chan_mobile.c (original)
+++ branches/12/addons/chan_mobile.c Wed Oct 2 17:34:05 2013
@@ -4705,7 +4705,7 @@
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);
Modified: branches/12/addons/chan_ooh323.c
URL: http://svnview.digium.com/svn/asterisk/branches/12/addons/chan_ooh323.c?view=diff&rev=400356&r1=400355&r2=400356
==============================================================================
--- branches/12/addons/chan_ooh323.c (original)
+++ branches/12/addons/chan_ooh323.c Wed Oct 2 17:34:05 2013
@@ -521,7 +521,7 @@
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 @@
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 @@
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 @@
.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));
Modified: branches/12/apps/app_confbridge.c
URL: http://svnview.digium.com/svn/asterisk/branches/12/apps/app_confbridge.c?view=diff&rev=400356&r1=400355&r2=400356
==============================================================================
--- branches/12/apps/app_confbridge.c (original)
+++ branches/12/apps/app_confbridge.c Wed Oct 2 17:34:05 2013
@@ -662,7 +662,7 @@
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 @@
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 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;
}
Modified: branches/12/apps/app_meetme.c
URL: http://svnview.digium.com/svn/asterisk/branches/12/apps/app_meetme.c?view=diff&rev=400356&r1=400355&r2=400356
==============================================================================
--- branches/12/apps/app_meetme.c (original)
+++ branches/12/apps/app_meetme.c Wed Oct 2 17:34:05 2013
@@ -1611,7 +1611,7 @@
struct ast_conference *cnf;
struct dahdi_confinfo dahdic = { 0, };
int confno_int = 0;
- struct ast_format_cap *cap_slin = ast_format_cap_alloc_nolock();
+ struct ast_format_cap *cap_slin = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_NOLOCK);
struct ast_format tmp_fmt;
AST_LIST_LOCK(&confs);
@@ -3216,7 +3216,7 @@
int setusercount = 0;
int confsilence = 0, totalsilence = 0;
char *mailbox, *context;
- struct ast_format_cap *cap_slin = ast_format_cap_alloc_nolock();
+ struct ast_format_cap *cap_slin = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_NOLOCK);
struct ast_format tmpfmt;
if (!cap_slin) {
Modified: branches/12/apps/app_originate.c
URL: http://svnview.digium.com/svn/asterisk/branches/12/apps/app_originate.c?view=diff&rev=400356&r1=400355&r2=400356
==============================================================================
--- branches/12/apps/app_originate.c (original)
+++ branches/12/apps/app_originate.c Wed Oct 2 17:34:05 2013
@@ -113,7 +113,7 @@
unsigned int timeout = 30;
static const char default_exten[] = "s";
struct ast_format tmpfmt;
- struct ast_format_cap *cap_slin = ast_format_cap_alloc_nolock();
+ struct ast_format_cap *cap_slin = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_NOLOCK);
ast_autoservice_start(chan);
if (!cap_slin) {
Modified: branches/12/bridges/bridge_holding.c
URL: http://svnview.digium.com/svn/asterisk/branches/12/bridges/bridge_holding.c?view=diff&rev=400356&r1=400355&r2=400356
==============================================================================
--- branches/12/bridges/bridge_holding.c (original)
+++ branches/12/bridges/bridge_holding.c Wed Oct 2 17:34:05 2013
@@ -433,7 +433,7 @@
static int load_module(void)
{
- if (!(holding_bridge.format_capabilities = ast_format_cap_alloc())) {
+ if (!(holding_bridge.format_capabilities = ast_format_cap_alloc(0))) {
return AST_MODULE_LOAD_DECLINE;
}
ast_format_cap_add_all_by_type(holding_bridge.format_capabilities, AST_FORMAT_TYPE_AUDIO);
Modified: branches/12/bridges/bridge_native_rtp.c
URL: http://svnview.digium.com/svn/asterisk/branches/12/bridges/bridge_native_rtp.c?view=diff&rev=400356&r1=400355&r2=400356
==============================================================================
--- branches/12/bridges/bridge_native_rtp.c (original)
+++ branches/12/bridges/bridge_native_rtp.c Wed Oct 2 17:34:05 2013
@@ -124,8 +124,8 @@
RAII_VAR(struct ast_rtp_instance *, vinstance1, NULL, ao2_cleanup);
RAII_VAR(struct ast_rtp_instance *, tinstance0, NULL, ao2_cleanup);
RAII_VAR(struct ast_rtp_instance *, tinstance1, NULL, ao2_cleanup);
- RAII_VAR(struct ast_format_cap *, cap0, ast_format_cap_alloc_nolock(), ast_format_cap_destroy);
- RAII_VAR(struct ast_format_cap *, cap1, ast_format_cap_alloc_nolock(), ast_format_cap_destroy);
+ RAII_VAR(struct ast_format_cap *, cap0, ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_NOLOCK), ast_format_cap_destroy);
+ RAII_VAR(struct ast_format_cap *, cap1, ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_NOLOCK), ast_format_cap_destroy);
if (c0 == c1) {
return 0;
@@ -279,8 +279,8 @@
RAII_VAR(struct ast_rtp_instance *, instance1, NULL, ao2_cleanup);
RAII_VAR(struct ast_rtp_instance *, vinstance0, NULL, ao2_cleanup);
RAII_VAR(struct ast_rtp_instance *, vinstance1, NULL, ao2_cleanup);
- RAII_VAR(struct ast_format_cap *, cap0, ast_format_cap_alloc_nolock(), ast_format_cap_destroy);
- RAII_VAR(struct ast_format_cap *, cap1, ast_format_cap_alloc_nolock(), ast_format_cap_destroy);
+ RAII_VAR(struct ast_format_cap *, cap0, ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_NOLOCK), ast_format_cap_destroy);
+ RAII_VAR(struct ast_format_cap *, cap1, ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_NOLOCK), ast_format_cap_destroy);
int read_ptime0, read_ptime1, write_ptime0, write_ptime1;
/* We require two channels before even considering native bridging */
@@ -448,7 +448,7 @@
static int load_module(void)
{
- if (!(native_rtp_bridge.format_capabilities = ast_format_cap_alloc())) {
+ if (!(native_rtp_bridge.format_capabilities = ast_format_cap_alloc(0))) {
return AST_MODULE_LOAD_DECLINE;
}
ast_format_cap_add_all_by_type(native_rtp_bridge.format_capabilities, AST_FORMAT_TYPE_AUDIO);
Modified: branches/12/bridges/bridge_simple.c
URL: http://svnview.digium.com/svn/asterisk/branches/12/bridges/bridge_simple.c?view=diff&rev=400356&r1=400355&r2=400356
==============================================================================
--- branches/12/bridges/bridge_simple.c (original)
+++ branches/12/bridges/bridge_simple.c Wed Oct 2 17:34:05 2013
@@ -82,7 +82,7 @@
static int load_module(void)
{
- if (!(simple_bridge.format_capabilities = ast_format_cap_alloc())) {
+ if (!(simple_bridge.format_capabilities = ast_format_cap_alloc(0))) {
return AST_MODULE_LOAD_DECLINE;
}
ast_format_cap_add_all_by_type(simple_bridge.format_capabilities, AST_FORMAT_TYPE_AUDIO);
Modified: branches/12/bridges/bridge_softmix.c
URL: http://svnview.digium.com/svn/asterisk/branches/12/bridges/bridge_softmix.c?view=diff&rev=400356&r1=400355&r2=400356
==============================================================================
--- branches/12/bridges/bridge_softmix.c (original)
+++ branches/12/bridges/bridge_softmix.c Wed Oct 2 17:34:05 2013
@@ -1137,7 +1137,7 @@
static int load_module(void)
{
struct ast_format tmp;
- if (!(softmix_bridge.format_capabilities = ast_format_cap_alloc())) {
+ if (!(softmix_bridge.format_capabilities = ast_format_cap_alloc(0))) {
return AST_MODULE_LOAD_DECLINE;
}
ast_format_cap_add(softmix_bridge.format_capabilities, ast_format_set(&tmp, AST_FORMAT_SLINEAR, 0));
Modified: branches/12/channels/chan_alsa.c
URL: http://svnview.digium.com/svn/asterisk/branches/12/channels/chan_alsa.c?view=diff&rev=400356&r1=400355&r2=400356
==============================================================================
--- branches/12/channels/chan_alsa.c (original)
+++ branches/12/channels/chan_alsa.c Wed Oct 2 17:34:05 2013
@@ -960,7 +960,7 @@
struct ast_flags config_flags = { 0 };
struct ast_format tmpfmt;
- if (!(alsa_tech.capabilities = ast_format_cap_alloc())) {
+ if (!(alsa_tech.capabilities = ast_format_cap_alloc(0))) {
return AST_MODULE_LOAD_DECLINE;
}
ast_format_cap_add(alsa_tech.capabilities, ast_format_set(&tmpfmt, AST_FORMAT_SLINEAR, 0));
Modified: branches/12/channels/chan_bridge_media.c
URL: http://svnview.digium.com/svn/asterisk/branches/12/channels/chan_bridge_media.c?view=diff&rev=400356&r1=400355&r2=400356
==============================================================================
--- branches/12/channels/chan_bridge_media.c (original)
+++ branches/12/channels/chan_bridge_media.c Wed Oct 2 17:34:05 2013
@@ -182,12 +182,12 @@
static int load_module(void)
{
- announce_tech.capabilities = ast_format_cap_alloc();
+ announce_tech.capabilities = ast_format_cap_alloc(0);
if (!announce_tech.capabilities) {
return AST_MODULE_LOAD_DECLINE;
}
- record_tech.capabilities = ast_format_cap_alloc();
+ record_tech.capabilities = ast_format_cap_alloc(0);
if (!record_tech.capabilities) {
return AST_MODULE_LOAD_DECLINE;
}
Modified: branches/12/channels/chan_console.c
URL: http://svnview.digium.com/svn/asterisk/branches/12/channels/chan_console.c?view=diff&rev=400356&r1=400355&r2=400356
==============================================================================
--- branches/12/channels/chan_console.c (original)
+++ branches/12/channels/chan_console.c Wed Oct 2 17:34:05 2013
@@ -1497,7 +1497,7 @@
struct ast_format tmpfmt;
PaError res;
- if (!(console_tech.capabilities = ast_format_cap_alloc())) {
+ if (!(console_tech.capabilities = ast_format_cap_alloc(0))) {
return AST_MODULE_LOAD_DECLINE;
}
ast_format_cap_add(console_tech.capabilities, ast_format_set(&tmpfmt, AST_FORMAT_SLINEAR16, 0));
Modified: branches/12/channels/chan_dahdi.c
URL: http://svnview.digium.com/svn/asterisk/branches/12/channels/chan_dahdi.c?view=diff&rev=400356&r1=400355&r2=400356
==============================================================================
--- branches/12/channels/chan_dahdi.c (original)
+++ branches/12/channels/chan_dahdi.c Wed Oct 2 17:34:05 2013
@@ -18550,7 +18550,7 @@
return AST_MODULE_LOAD_FAILURE;
}
- if (!(dahdi_tech.capabilities = ast_format_cap_alloc())) {
+ if (!(dahdi_tech.capabilities = ast_format_cap_alloc(0))) {
return AST_MODULE_LOAD_FAILURE;
}
ast_format_cap_add(dahdi_tech.capabilities, ast_format_set(&tmpfmt, AST_FORMAT_SLINEAR, 0));
Modified: branches/12/channels/chan_gtalk.c
URL: http://svnview.digium.com/svn/asterisk/branches/12/channels/chan_gtalk.c?view=diff&rev=400356&r1=400355&r2=400356
==============================================================================
--- branches/12/channels/chan_gtalk.c (original)
+++ branches/12/channels/chan_gtalk.c Wed Oct 2 17:34:05 2013
@@ -436,7 +436,7 @@
iks_insert_attrib(dcodecs, "xmlns", GOOGLE_AUDIO_NS);
iks_insert_attrib(dcodecs, "xml:lang", "en");
- if (!(alreadysent = ast_format_cap_alloc_nolock())) {
+ if (!(alreadysent = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_NOLOCK))) {
return 0;
}
for (x = 0; x < AST_CODEC_PREF_SIZE; x++) {
@@ -1063,9 +1063,9 @@
if (!(tmp = ast_calloc(1, sizeof(*tmp)))) {
return NULL;
}
- tmp->cap = ast_format_cap_alloc_nolock();
- tmp->jointcap = ast_format_cap_alloc_nolock();
- tmp->peercap = ast_format_cap_alloc_nolock();
+ tmp->cap = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_NOLOCK);
+ tmp->jointcap = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_NOLOCK);
+ tmp->peercap = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_NOLOCK);
if (!tmp->jointcap || !tmp->peercap || !tmp->cap) {
tmp->cap = ast_format_cap_destroy(tmp->cap);
tmp->jointcap = ast_format_cap_destroy(tmp->jointcap);
@@ -2256,7 +2256,7 @@
member = ast_calloc(1, sizeof(*member));
ASTOBJ_INIT(member);
ASTOBJ_WRLOCK(member);
- member->cap = ast_format_cap_alloc_nolock();
+ member->cap = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_NOLOCK);
if (!strcasecmp(cat, "guest")) {
ast_copy_string(member->name, "guest", sizeof(member->name));
ast_copy_string(member->user, "guest", sizeof(member->user));
@@ -2336,10 +2336,10 @@
char *jabber_loaded = ast_module_helper("", "res_jabber.so", 0, 0, 0, 0);
struct ast_format tmpfmt;
- if (!(gtalk_tech.capabilities = ast_format_cap_alloc())) {
+ if (!(gtalk_tech.capabilities = ast_format_cap_alloc(0))) {
return AST_MODULE_LOAD_DECLINE;
}
- if (!(global_capability = ast_format_cap_alloc())) {
+ if (!(global_capability = ast_format_cap_alloc(0))) {
return AST_MODULE_LOAD_DECLINE;
}
Modified: branches/12/channels/chan_h323.c
URL: http://svnview.digium.com/svn/asterisk/branches/12/channels/chan_h323.c?view=diff&rev=400356&r1=400355&r2=400356
==============================================================================
--- branches/12/channels/chan_h323.c (original)
+++ branches/12/channels/chan_h323.c Wed Oct 2 17:34:05 2013
@@ -1313,7 +1313,7 @@
static int h323_parse_allow_disallow(struct ast_codec_pref *pref, h323_format *formats, const char *list, int allowing)
{
int res;
- struct ast_format_cap *cap = ast_format_cap_alloc_nolock();
+ struct ast_format_cap *cap = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_NOLOCK);
if (!cap) {
return 1;
}
@@ -2093,7 +2093,7 @@
/* Don't try to lock the channel if nothing changed */
if (nativeformats_changed || pvt->options.progress_audio || (rtp_change != NEED_NONE)) {
if (pvt->owner && !ast_channel_trylock(pvt->owner)) {
- struct ast_format_cap *pvt_native = ast_format_cap_alloc_nolock();
+ struct ast_format_cap *pvt_native = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_NOLOCK);
ast_format_cap_from_old_bitfield(pvt_native, pvt->nativeformats);
/* Re-build translation path only if native format(s) has been changed */
@@ -3336,7 +3336,7 @@
{
int res;
- if (!(oh323_tech.capabilities = ast_format_cap_alloc())) {
+ if (!(oh323_tech.capabilities = ast_format_cap_alloc(0))) {
return AST_MODULE_LOAD_FAILURE;
}
ast_format_cap_add_all_by_type(oh323_tech.capabilities, AST_FORMAT_TYPE_AUDIO);
Modified: branches/12/channels/chan_iax2.c
URL: http://svnview.digium.com/svn/asterisk/branches/12/channels/chan_iax2.c?view=diff&rev=400356&r1=400355&r2=400356
==============================================================================
--- branches/12/channels/chan_iax2.c (original)
+++ branches/12/channels/chan_iax2.c Wed Oct 2 17:34:05 2013
@@ -1717,7 +1717,7 @@
struct ast_format_cap *cap;
struct ast_format tmpfmt;
iax2_format format = 0;
- if ((cap = ast_format_cap_alloc_nolock())) {
+ if ((cap = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_NOLOCK))) {
ast_format_clear(&tmpfmt);
ast_format_cap_from_old_bitfield(cap, formats);
ast_codec_choose(pref, cap, find_best, &tmpfmt);
@@ -1730,7 +1730,7 @@
static iax2_format iax2_best_codec(iax2_format formats)
{
- struct ast_format_cap *cap = ast_format_cap_alloc_nolock();
+ struct ast_format_cap *cap = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_NOLOCK);
struct ast_format tmpfmt;
if (!cap) {
return 0;
@@ -1755,7 +1755,7 @@
static char *iax2_getformatname_multiple(char *codec_buf, size_t len, iax2_format format)
{
- struct ast_format_cap *cap = ast_format_cap_alloc_nolock();
+ struct ast_format_cap *cap = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_NOLOCK);
if (!cap) {
return "(Nothing)";
@@ -1770,7 +1770,7 @@
static int iax2_parse_allow_disallow(struct ast_codec_pref *pref, iax2_format *formats, const char *list, int allowing)
{
int res;
- struct ast_format_cap *cap = ast_format_cap_alloc_nolock();
+ struct ast_format_cap *cap = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_NOLOCK);
if (!cap) {
return 1;
}
@@ -1786,7 +1786,7 @@
static int iax2_data_add_codecs(struct ast_data *root, const char *node_name, iax2_format formats)
{
int res;
- struct ast_format_cap *cap = ast_format_cap_alloc_nolock();
+ struct ast_format_cap *cap = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_NOLOCK);
if (!cap) {
return -1;
}
@@ -14624,7 +14624,7 @@
int x = 0;
struct iax2_registry *reg = NULL;
- if (!(iax2_tech.capabilities = ast_format_cap_alloc())) {
+ if (!(iax2_tech.capabilities = ast_format_cap_alloc(0))) {
return AST_MODULE_LOAD_FAILURE;
}
ast_format_cap_add_all(iax2_tech.capabilities);
Modified: branches/12/channels/chan_jingle.c
URL: http://svnview.digium.com/svn/asterisk/branches/12/channels/chan_jingle.c?view=diff&rev=400356&r1=400355&r2=400356
==============================================================================
--- branches/12/channels/chan_jingle.c (original)
+++ branches/12/channels/chan_jingle.c Wed Oct 2 17:34:05 2013
@@ -322,7 +322,7 @@
iks *iq, *jingle, *dcodecs, *payload_red, *payload_audio, *payload_cn;
int x;
struct ast_format pref_codec;
- struct ast_format_cap *alreadysent = ast_format_cap_alloc_nolock();
+ struct ast_format_cap *alreadysent = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_NOLOCK);
if (p->initiator || !alreadysent)
return 1;
@@ -798,9 +798,9 @@
return NULL;
}
- tmp->cap = ast_format_cap_alloc_nolock();
- tmp->jointcap = ast_format_cap_alloc_nolock();
- tmp->peercap = ast_format_cap_alloc_nolock();
+ tmp->cap = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_NOLOCK);
+ tmp->jointcap = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_NOLOCK);
+ tmp->peercap = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_NOLOCK);
if (!tmp->cap || !tmp->jointcap || !tmp->peercap) {
tmp->cap = ast_format_cap_destroy(tmp->cap);
tmp->jointcap = ast_format_cap_destroy(tmp->jointcap);
@@ -1897,7 +1897,7 @@
member = ast_calloc(1, sizeof(*member));
ASTOBJ_INIT(member);
ASTOBJ_WRLOCK(member);
- member->cap = ast_format_cap_alloc_nolock();
+ member->cap = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_NOLOCK);
if (!strcasecmp(cat, "guest")) {
ast_copy_string(member->name, "guest", sizeof(member->name));
ast_copy_string(member->user, "guest", sizeof(member->user));
@@ -1981,12 +1981,12 @@
char *jabber_loaded = ast_module_helper("", "res_jabber.so", 0, 0, 0, 0);
- if (!(jingle_tech.capabilities = ast_format_cap_alloc())) {
+ if (!(jingle_tech.capabilities = ast_format_cap_alloc(0))) {
return AST_MODULE_LOAD_DECLINE;
}
ast_format_cap_add_all_by_type(jingle_tech.capabilities, AST_FORMAT_TYPE_AUDIO);
- if (!(global_capability = ast_format_cap_alloc())) {
+ if (!(global_capability = ast_format_cap_alloc(0))) {
return AST_MODULE_LOAD_DECLINE;
}
ast_format_cap_add(global_capability, ast_format_set(&tmpfmt, AST_FORMAT_ULAW, 0));
Modified: branches/12/channels/chan_mgcp.c
URL: http://svnview.digium.com/svn/asterisk/branches/12/channels/chan_mgcp.c?view=diff&rev=400356&r1=400355&r2=400356
==============================================================================
--- branches/12/channels/chan_mgcp.c (original)
+++ branches/12/channels/chan_mgcp.c Wed Oct 2 17:34:05 2013
@@ -2039,7 +2039,7 @@
}
/* Now gather all of the codecs that were asked for: */
- if (!(peercap = ast_format_cap_alloc_nolock())) {
+ if (!(peercap = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_NOLOCK))) {
return -1;
}
ast_rtp_codecs_payload_formats(ast_rtp_instance_get_codecs(sub->rtp), peercap, &peerNonCodecCapability);
@@ -4172,7 +4172,7 @@
ast_mutex_init(&e->lock);
ast_mutex_init(&e->rqnt_queue_lock);
ast_mutex_init(&e->cmd_queue_lock);
- e->cap = ast_format_cap_alloc_nolock();
+ e->cap = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_NOLOCK);
ast_copy_string(e->name, v->value, sizeof(e->name));
e->needaudit = 1;
}
@@ -4288,7 +4288,7 @@
ast_mutex_init(&e->lock);
ast_mutex_init(&e->rqnt_queue_lock);
ast_mutex_init(&e->cmd_queue_lock);
- e->cap = ast_format_cap_alloc_nolock();
+ e->cap = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_NOLOCK);
ast_copy_string(e->name, v->value, sizeof(e->name));
e->needaudit = 1;
}
@@ -4829,10 +4829,10 @@
{
struct ast_format tmpfmt;
- if (!(global_capability = ast_format_cap_alloc())) {
+ if (!(global_capability = ast_format_cap_alloc(0))) {
return AST_MODULE_LOAD_FAILURE;
}
- if (!(mgcp_tech.capabilities = ast_format_cap_alloc())) {
+ if (!(mgcp_tech.capabilities = ast_format_cap_alloc(0))) {
return AST_MODULE_LOAD_FAILURE;
}
ast_format_cap_add(global_capability, ast_format_set(&tmpfmt, AST_FORMAT_ULAW, 0));
Modified: branches/12/channels/chan_misdn.c
URL: http://svnview.digium.com/svn/asterisk/branches/12/channels/chan_misdn.c?view=diff&rev=400356&r1=400355&r2=400356
==============================================================================
--- branches/12/channels/chan_misdn.c (original)
+++ branches/12/channels/chan_misdn.c Wed Oct 2 17:34:05 2013
@@ -10193,7 +10193,7 @@
ch->addr = bc->addr;
{
- struct ast_format_cap *cap = ast_format_cap_alloc_nolock();
+ struct ast_format_cap *cap = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_NOLOCK);
struct ast_format tmpfmt;
if (!(cap)) {
return RESPONSE_ERR;
@@ -11298,7 +11298,7 @@
};
- if (!(misdn_tech.capabilities = ast_format_cap_alloc())) {
+ if (!(misdn_tech.capabilities = ast_format_cap_alloc(0))) {
return AST_MODULE_LOAD_DECLINE;
}
ast_format_set(&prefformat, AST_FORMAT_ALAW, 0);
Modified: branches/12/channels/chan_motif.c
URL: http://svnview.digium.com/svn/asterisk/branches/12/channels/chan_motif.c?view=diff&rev=400356&r1=400355&r2=400356
==============================================================================
--- branches/12/channels/chan_motif.c (original)
+++ branches/12/channels/chan_motif.c Wed Oct 2 17:34:05 2013
@@ -519,7 +519,7 @@
ast_string_field_set(endpoint, name, cat);
- endpoint->cap = ast_format_cap_alloc_nolock();
+ endpoint->cap = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_NOLOCK);
endpoint->transport = JINGLE_TRANSPORT_ICE_UDP;
return endpoint;
@@ -741,9 +741,9 @@
session->connection = endpoint->connection;
session->transport = endpoint->transport;
- if (!(session->cap = ast_format_cap_alloc_nolock()) ||
- !(session->jointcap = ast_format_cap_alloc_nolock()) ||
- !(session->peercap = ast_format_cap_alloc_nolock()) ||
+ if (!(session->cap = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_NOLOCK)) ||
+ !(session->jointcap = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_NOLOCK)) ||
+ !(session->peercap = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_NOLOCK)) ||
!session->callid) {
ao2_ref(session, -1);
return NULL;
@@ -2707,7 +2707,7 @@
*/
static int load_module(void)
{
- if (!(jingle_tech.capabilities = ast_format_cap_alloc())) {
+ if (!(jingle_tech.capabilities = ast_format_cap_alloc(0))) {
return AST_MODULE_LOAD_DECLINE;
}
Modified: branches/12/channels/chan_multicast_rtp.c
URL: http://svnview.digium.com/svn/asterisk/branches/12/channels/chan_multicast_rtp.c?view=diff&rev=400356&r1=400355&r2=400356
==============================================================================
--- branches/12/channels/chan_multicast_rtp.c (original)
+++ branches/12/channels/chan_multicast_rtp.c Wed Oct 2 17:34:05 2013
@@ -176,7 +176,7 @@
/*! \brief Function called when our module is loaded */
static int load_module(void)
{
- if (!(multicast_rtp_tech.capabilities = ast_format_cap_alloc())) {
+ if (!(multicast_rtp_tech.capabilities = ast_format_cap_alloc(0))) {
return AST_MODULE_LOAD_DECLINE;
}
ast_format_cap_add_all(multicast_rtp_tech.capabilities);
Modified: branches/12/channels/chan_nbs.c
URL: http://svnview.digium.com/svn/asterisk/branches/12/channels/chan_nbs.c?view=diff&rev=400356&r1=400355&r2=400356
==============================================================================
--- branches/12/channels/chan_nbs.c (original)
+++ branches/12/channels/chan_nbs.c Wed Oct 2 17:34:05 2013
@@ -281,7 +281,7 @@
static int load_module(void)
{
ast_format_set(&prefformat, AST_FORMAT_SLINEAR, 0);
- if (!(nbs_tech.capabilities = ast_format_cap_alloc())) {
+ if (!(nbs_tech.capabilities = ast_format_cap_alloc(0))) {
return AST_MODULE_LOAD_FAILURE;
}
ast_format_cap_add(nbs_tech.capabilities, &prefformat);
Modified: branches/12/channels/chan_oss.c
URL: http://svnview.digium.com/svn/asterisk/branches/12/channels/chan_oss.c?view=diff&rev=400356&r1=400355&r2=400356
==============================================================================
--- branches/12/channels/chan_oss.c (original)
+++ branches/12/channels/chan_oss.c Wed Oct 2 17:34:05 2013
@@ -1479,7 +1479,7 @@
return AST_MODULE_LOAD_FAILURE;
}
- if (!(oss_tech.capabilities = ast_format_cap_alloc())) {
+ if (!(oss_tech.capabilities = ast_format_cap_alloc(0))) {
return AST_MODULE_LOAD_FAILURE;
}
ast_format_cap_add(oss_tech.capabilities, ast_format_set(&tmpfmt, AST_FORMAT_SLINEAR, 0));
Modified: branches/12/channels/chan_phone.c
URL: http://svnview.digium.com/svn/asterisk/branches/12/channels/chan_phone.c?view=diff&rev=400356&r1=400355&r2=400356
==============================================================================
--- branches/12/channels/chan_phone.c (original)
+++ branches/12/channels/chan_phone.c Wed Oct 2 17:34:05 2013
@@ -1376,7 +1376,7 @@
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 @@
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;
}
Modified: branches/12/channels/chan_pjsip.c
URL: http://svnview.digium.com/svn/asterisk/branches/12/channels/chan_pjsip.c?view=diff&rev=400356&r1=400355&r2=400356
==============================================================================
--- branches/12/channels/chan_pjsip.c (original)
+++ branches/12/channels/chan_pjsip.c Wed Oct 2 17:34:05 2013
@@ -2065,7 +2065,7 @@
*/
static int load_module(void)
{
- if (!(chan_pjsip_tech.capabilities = ast_format_cap_alloc())) {
+ if (!(chan_pjsip_tech.capabilities = ast_format_cap_alloc(0))) {
return AST_MODULE_LOAD_DECLINE;
}
Modified: branches/12/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/branches/12/channels/chan_sip.c?view=diff&rev=400356&r1=400355&r2=400356
==============================================================================
--- branches/12/channels/chan_sip.c (original)
+++ branches/12/channels/chan_sip.c Wed Oct 2 17:34:05 2013
@@ -8814,11 +8814,11 @@
sip_pvt_callid_set(p, logger_callid);
}
- p->caps = ast_format_cap_alloc_nolock();
- p->jointcaps = ast_format_cap_alloc_nolock();
- p->peercaps = ast_format_cap_alloc_nolock();
- p->redircaps = ast_format_cap_alloc_nolock();
- p->prefcaps = ast_format_cap_alloc_nolock();
+ p->caps = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_NOLOCK);
+ p->jointcaps = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_NOLOCK);
+ p->peercaps = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_NOLOCK);
+ p->redircaps = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_NOLOCK);
+ p->prefcaps = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_NOLOCK);
if (!p->caps|| !p->jointcaps || !p->peercaps || !p->redircaps) {
p->caps = ast_format_cap_destroy(p->caps);
@@ -10052,15 +10052,15 @@
int udptlportno = -1; /*!< UDPTL image destination port number */
/* Peer capability is the capability in the SDP, non codec is RFC2833 DTMF (101) */
- struct ast_format_cap *peercapability = ast_format_cap_alloc_nolock();
- struct ast_format_cap *vpeercapability = ast_format_cap_alloc_nolock();
- struct ast_format_cap *tpeercapability = ast_format_cap_alloc_nolock();
+ struct ast_format_cap *peercapability = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_NOLOCK);
+ struct ast_format_cap *vpeercapability = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_NOLOCK);
+ struct ast_format_cap *tpeercapability = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_NOLOCK);
int peernoncodeccapability = 0, vpeernoncodeccapability = 0, tpeernoncodeccapability = 0;
struct ast_rtp_codecs newaudiortp = { 0, }, newvideortp = { 0, }, newtextrtp = { 0, };
- struct ast_format_cap *newjointcapability = ast_format_cap_alloc_nolock(); /* Negotiated capability */
- struct ast_format_cap *newpeercapability = ast_format_cap_alloc_nolock();
+ struct ast_format_cap *newjointcapability = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_NOLOCK); /* Negotiated capability */
+ struct ast_format_cap *newpeercapability = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_NOLOCK);
int newnoncodeccapability;
const char *codecs;
@@ -13136,8 +13136,8 @@
*/
static enum sip_result add_sdp(struct sip_request *resp, struct sip_pvt *p, int oldsdp, int add_audio, int add_t38)
{
- struct ast_format_cap *alreadysent = ast_format_cap_alloc_nolock();
- struct ast_format_cap *tmpcap = ast_format_cap_alloc_nolock();
+ struct ast_format_cap *alreadysent = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_NOLOCK);
+ struct ast_format_cap *tmpcap = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_NOLOCK);
int res = AST_SUCCESS;
int doing_directmedia = FALSE;
struct ast_sockaddr addr = { {0,} };
@@ -30358,7 +30358,7 @@
return NULL;
}
- if (!(peer->caps = ast_format_cap_alloc_nolock())) {
+ if (!(peer->caps = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_NOLOCK))) {
ao2_t_ref(peer, -1, "failed to allocate format capabilities, drop peer");
return NULL;
}
@@ -30467,7 +30467,7 @@
if (!(peer->endpoint = ast_endpoint_create("SIP", name))) {
return NULL;
}
- if (!(peer->caps = ast_format_cap_alloc_nolock())) {
+ if (!(peer->caps = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_NOLOCK))) {
ao2_t_ref(peer, -1, "failed to allocate format capabilities, drop peer");
return NULL;
}
@@ -34351,7 +34351,7 @@
return AST_MODULE_LOAD_FAILURE;
}
- if (!(sip_tech.capabilities = ast_format_cap_alloc())) {
+ if (!(sip_tech.capabilities = ast_format_cap_alloc(0))) {
return AST_MODULE_LOAD_FAILURE;
}
@@ -34373,7 +34373,7 @@
return AST_MODULE_LOAD_FAILURE;
}
- if (!(sip_cfg.caps = ast_format_cap_alloc())) {
+ if (!(sip_cfg.caps = ast_format_cap_alloc(0))) {
return AST_MODULE_LOAD_FAILURE;
}
ast_format_cap_add_all_by_type(sip_tech.capabilities, AST_FORMAT_TYPE_AUDIO);
Modified: branches/12/channels/chan_skinny.c
URL: http://svnview.digium.com/svn/asterisk/branches/12/channels/chan_skinny.c?view=diff&rev=400356&r1=400355&r2=400356
==============================================================================
--- branches/12/channels/chan_skinny.c (original)
+++ branches/12/channels/chan_skinny.c Wed Oct 2 17:34:05 2013
@@ -1677,8 +1677,8 @@
return NULL;
}
- l->cap = ast_format_cap_alloc_nolock();
- l->confcap = ast_format_cap_alloc_nolock();
+ l->cap = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_NOLOCK);
+ l->confcap = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_NOLOCK);
if (!l->cap || !l->confcap) {
l->cap = ast_format_cap_destroy(l->cap);
l->confcap = ast_format_cap_destroy(l->confcap);
@@ -1704,8 +1704,8 @@
return NULL;
}
- d->cap = ast_format_cap_alloc_nolock();
- d->confcap = ast_format_cap_alloc_nolock();
+ d->cap = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_NOLOCK);
+ d->confcap = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_NOLOCK);
d->endpoint = ast_endpoint_create("Skinny", dname);
if (!d->cap || !d->confcap || !d->endpoint) {
d->cap = ast_format_cap_destroy(d->cap);
@@ -6643,7 +6643,7 @@
struct skinny_device *d = s->device;
struct skinny_line *l;
uint32_t count = 0;
- struct ast_format_cap *codecs = ast_format_cap_alloc();
+ struct ast_format_cap *codecs = ast_format_cap_alloc(0);
int i;
if (!codecs) {
@@ -8635,10 +8635,10 @@
{
int res = 0;
struct ast_format tmpfmt;
- if (!(default_cap = ast_format_cap_alloc())) {
+ if (!(default_cap = ast_format_cap_alloc(0))) {
return AST_MODULE_LOAD_DECLINE;
}
- if (!(skinny_tech.capabilities = ast_format_cap_alloc())) {
+ if (!(skinny_tech.capabilities = ast_format_cap_alloc(0))) {
return AST_MODULE_LOAD_DECLINE;
}
Modified: branches/12/channels/chan_unistim.c
URL: http://svnview.digium.com/svn/asterisk/branches/12/channels/chan_unistim.c?view=diff&rev=400356&r1=400355&r2=400356
==============================================================================
--- branches/12/channels/chan_unistim.c (original)
+++ branches/12/channels/chan_unistim.c Wed Oct 2 17:34:05 2013
@@ -1836,7 +1836,7 @@
return NULL;
}
- if (!(l->cap = ast_format_cap_alloc_nolock())) {
+ if (!(l->cap = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_NOLOCK))) {
ast_free(l);
return NULL;
}
@@ -6853,10 +6853,10 @@
{
int res;
struct ast_format tmpfmt;
- if (!(global_cap = ast_format_cap_alloc())) {
+ if (!(global_cap = ast_format_cap_alloc(0))) {
goto buff_failed;
}
- if (!(unistim_tech.capabilities = ast_format_cap_alloc())) {
+ if (!(unistim_tech.capabilities = ast_format_cap_alloc(0))) {
goto buff_failed;
}
Modified: branches/12/channels/dahdi/bridge_native_dahdi.c
URL: http://svnview.digium.com/svn/asterisk/branches/12/channels/dahdi/bridge_native_dahdi.c?view=diff&rev=400356&r1=400355&r2=400356
==============================================================================
--- branches/12/channels/dahdi/bridge_native_dahdi.c (original)
+++ branches/12/channels/dahdi/bridge_native_dahdi.c Wed Oct 2 17:34:05 2013
@@ -911,7 +911,7 @@
dahdi_tech = tech;
- native_bridge.format_capabilities = ast_format_cap_alloc();
+ native_bridge.format_capabilities = ast_format_cap_alloc(0);
if (!native_bridge.format_capabilities) {
return -1;
}
Modified: branches/12/include/asterisk/format_cap.h
URL: http://svnview.digium.com/svn/asterisk/branches/12/include/asterisk/format_cap.h?view=diff&rev=400356&r1=400355&r2=400356
==============================================================================
--- branches/12/include/asterisk/format_cap.h (original)
+++ branches/12/include/asterisk/format_cap.h Wed Oct 2 17:34:05 2013
@@ -29,32 +29,27 @@
/*! Capabilities are represented by an opaque structure statically defined in format_capability.c */
struct ast_format_cap;
-/*!
- * \brief Allocate a new ast_format_cap structure.
- *
- * \note Allocation of this object assumes locking
- * is already occuring and that the point of contention
- * is above this capabilities structure. For example,
- * a tech_pvt object referencing a capabilities structure
- * can use this function as long as it always holds the
- * tech_pvt lock while accessing its capabilities.
- *
+enum ast_format_cap_flags {
+ /*!
+ * The ast_format_cap will be allocated with no lock.
+ * Useful if there is a separate lock used to protect the structure
+ */
+ AST_FORMAT_CAP_FLAG_NOLOCK = (1 << 0),
+ /*!
+ * String representations of the formats are cached on the structure.
+ * Useful if string representation is frequently requested of the structure.
+ */
+ AST_FORMAT_CAP_FLAG_CACHE_STRINGS = (1 << 1),
+};
+
+/*!
+ * \brief Allocate a new ast_format_cap structure
+ *
[... 790 lines stripped ...]
More information about the svn-commits
mailing list