summaryrefslogtreecommitdiff
path: root/channels
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 /channels
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 'channels')
-rw-r--r--channels/chan_alsa.c2
-rw-r--r--channels/chan_bridge_media.c4
-rw-r--r--channels/chan_console.c2
-rw-r--r--channels/chan_dahdi.c2
-rw-r--r--channels/chan_gtalk.c14
-rw-r--r--channels/chan_h323.c6
-rw-r--r--channels/chan_iax2.c12
-rw-r--r--channels/chan_jingle.c14
-rw-r--r--channels/chan_mgcp.c10
-rw-r--r--channels/chan_misdn.c4
-rw-r--r--channels/chan_motif.c10
-rw-r--r--channels/chan_multicast_rtp.c2
-rw-r--r--channels/chan_nbs.c2
-rw-r--r--channels/chan_oss.c2
-rw-r--r--channels/chan_phone.c6
-rw-r--r--channels/chan_pjsip.c2
-rw-r--r--channels/chan_sip.c32
-rw-r--r--channels/chan_skinny.c14
-rw-r--r--channels/chan_unistim.c6
-rw-r--r--channels/dahdi/bridge_native_dahdi.c2
20 files changed, 74 insertions, 74 deletions
diff --git a/channels/chan_alsa.c b/channels/chan_alsa.c
index f1720ba8c..60bbacbb8 100644
--- a/channels/chan_alsa.c
+++ b/channels/chan_alsa.c
@@ -960,7 +960,7 @@ static int load_module(void)
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));
diff --git a/channels/chan_bridge_media.c b/channels/chan_bridge_media.c
index 663578033..7aaca6671 100644
--- a/channels/chan_bridge_media.c
+++ b/channels/chan_bridge_media.c
@@ -182,12 +182,12 @@ static int unload_module(void)
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;
}
diff --git a/channels/chan_console.c b/channels/chan_console.c
index 76571d209..922c53b42 100644
--- a/channels/chan_console.c
+++ b/channels/chan_console.c
@@ -1497,7 +1497,7 @@ static int load_module(void)
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));
diff --git a/channels/chan_dahdi.c b/channels/chan_dahdi.c
index 65a9758f2..e52969b5d 100644
--- a/channels/chan_dahdi.c
+++ b/channels/chan_dahdi.c
@@ -18550,7 +18550,7 @@ static int load_module(void)
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));
diff --git a/channels/chan_gtalk.c b/channels/chan_gtalk.c
index a44ca57f4..d6a094941 100644
--- a/channels/chan_gtalk.c
+++ b/channels/chan_gtalk.c
@@ -436,7 +436,7 @@ static int gtalk_invite(struct gtalk_pvt *p, char *to, char *from, char *sid, in
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 @@ static struct gtalk_pvt *gtalk_alloc(struct gtalk *client, const char *us, const
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 @@ static int gtalk_load_config(void)
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 @@ static int load_module(void)
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;
}
diff --git a/channels/chan_h323.c b/channels/chan_h323.c
index dd23b7f59..22dba3c18 100644
--- a/channels/chan_h323.c
+++ b/channels/chan_h323.c
@@ -1313,7 +1313,7 @@ static struct oh323_alias *realtime_alias(const char *alias)
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 @@ static void setup_rtp_connection(unsigned call_reference, const char *remoteIp,
/* 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 @@ static enum ast_module_load_result load_module(void)
{
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);
diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c
index 551c2046d..77fd44277 100644
--- a/channels/chan_iax2.c
+++ b/channels/chan_iax2.c
@@ -1717,7 +1717,7 @@ static iax2_format iax2_codec_choose(struct ast_codec_pref *pref, iax2_format fo
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_codec_choose(struct ast_codec_pref *pref, iax2_format fo
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 @@ const char *iax2_getformatname(iax2_format format)
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 char *iax2_getformatname_multiple(char *codec_buf, size_t len, iax2_forma
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_parse_allow_disallow(struct ast_codec_pref *pref, iax2_format *f
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 @@ static int load_module(void)
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);
diff --git a/channels/chan_jingle.c b/channels/chan_jingle.c
index a8cab6238..56c15b193 100644
--- a/channels/chan_jingle.c
+++ b/channels/chan_jingle.c
@@ -322,7 +322,7 @@ static int jingle_accept_call(struct jingle *client, struct jingle_pvt *p)
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 @@ static struct jingle_pvt *jingle_alloc(struct jingle *client, const char *from,
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 @@ static int jingle_load_config(void)
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 @@ static int load_module(void)
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));
diff --git a/channels/chan_mgcp.c b/channels/chan_mgcp.c
index 7c9120088..a659a2aab 100644
--- a/channels/chan_mgcp.c
+++ b/channels/chan_mgcp.c
@@ -2039,7 +2039,7 @@ static int process_sdp(struct mgcp_subchannel *sub, struct mgcp_request *req)
}
/* 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 @@ static struct mgcp_gateway *build_gateway(char *cat, struct ast_variable *v)
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 @@ static struct mgcp_gateway *build_gateway(char *cat, struct ast_variable *v)
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 @@ static int load_module(void)
{
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));
diff --git a/channels/chan_misdn.c b/channels/chan_misdn.c
index 29274e743..38197c638 100644
--- a/channels/chan_misdn.c
+++ b/channels/chan_misdn.c
@@ -10193,7 +10193,7 @@ cb_events(enum event_e event, struct misdn_bchannel *bc, void *user_data)
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 @@ static int load_module(void)
};
- 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);
diff --git a/channels/chan_motif.c b/channels/chan_motif.c
index e13c66c6f..1e7ee3cce 100644
--- a/channels/chan_motif.c
+++ b/channels/chan_motif.c
@@ -519,7 +519,7 @@ static void *jingle_endpoint_alloc(const char *cat)
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 @@ static struct jingle_session *jingle_alloc(struct jingle_endpoint *endpoint, con
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 custom_transport_handler(const struct aco_option *opt, struct ast_var
*/
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;
}
diff --git a/channels/chan_multicast_rtp.c b/channels/chan_multicast_rtp.c
index 462982969..1b9e4d31f 100644
--- a/channels/chan_multicast_rtp.c
+++ b/channels/chan_multicast_rtp.c
@@ -176,7 +176,7 @@ failure:
/*! \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);
diff --git a/channels/chan_nbs.c b/channels/chan_nbs.c
index e6384872e..1d8c59d4e 100644
--- a/channels/chan_nbs.c
+++ b/channels/chan_nbs.c
@@ -281,7 +281,7 @@ static int unload_module(void)
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);
diff --git a/channels/chan_oss.c b/channels/chan_oss.c
index f8e67e59e..5ae18f362 100644
--- a/channels/chan_oss.c
+++ b/channels/chan_oss.c
@@ -1479,7 +1479,7 @@ static int load_module(void)
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));
diff --git a/channels/chan_phone.c b/channels/chan_phone.c
index 71a498a85..c1a24b8b1 100644
--- a/channels/chan_phone.c
+++ b/channels/chan_phone.c
@@ -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;
}
diff --git a/channels/chan_pjsip.c b/channels/chan_pjsip.c
index e505751c3..6ceece4fc 100644
--- a/channels/chan_pjsip.c
+++ b/channels/chan_pjsip.c
@@ -2065,7 +2065,7 @@ static int chan_pjsip_incoming_ack(struct ast_sip_session *session, struct pjsip
*/
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;
}
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index 497fb6e61..00a2a16cb 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -8814,11 +8814,11 @@ struct sip_pvt *sip_alloc(ast_string_field callid, struct ast_sockaddr *addr,
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 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req, int t38action
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 char *crypto_get_attrib(struct ast_sdp_srtp *srtp, int dtls_enabled, int
*/
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 @@ static struct sip_peer *temp_peer(const char *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;
}
@@ -30467,7 +30467,7 @@ static struct sip_peer *build_peer(const char *name, struct ast_variable *v, str
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 @@ static int load_module(void)
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 @@ static int load_module(void)
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);
diff --git a/channels/chan_skinny.c b/channels/chan_skinny.c
index 496de1866..a65862ff3 100644
--- a/channels/chan_skinny.c
+++ b/channels/chan_skinny.c
@@ -1677,8 +1677,8 @@ static struct skinny_line *skinny_line_alloc(void)
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 @@ static struct skinny_device *skinny_device_alloc(const char *dname)
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 @@ static int handle_capabilities_res_message(struct skinny_req *req, struct skinny
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 @@ static int load_module(void)
{
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;
}
diff --git a/channels/chan_unistim.c b/channels/chan_unistim.c
index 523867988..547cd7c2f 100644
--- a/channels/chan_unistim.c
+++ b/channels/chan_unistim.c
@@ -1836,7 +1836,7 @@ static struct unistim_line *unistim_line_alloc(void)
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 load_module(void)
{
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;
}
diff --git a/channels/dahdi/bridge_native_dahdi.c b/channels/dahdi/bridge_native_dahdi.c
index 13e1a84dd..7505eca3e 100644
--- a/channels/dahdi/bridge_native_dahdi.c
+++ b/channels/dahdi/bridge_native_dahdi.c
@@ -911,7 +911,7 @@ int dahdi_native_load(struct ast_module *mod, const struct ast_channel_tech *tec
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;
}