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);
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;
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;
}
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;
}
.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));
return -1;
}
- cap = ast_format_cap_alloc_nolock();
+ cap = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_NOLOCK);
if (!cap) {
return -1;
}
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;
}
*/
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;
}
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);
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) {
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) {
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);
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;
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 */
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);
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);
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));
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));
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;
}
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));
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));
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++) {
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);
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));
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;
}
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;
}
/* 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 */
{
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);
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);
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;
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)";
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;
}
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;
}
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);
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;
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);
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));
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));
}
/* 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);
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;
}
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;
}
{
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));
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;
};
- 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);
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;
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;
*/
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;
}
/*! \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);
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);
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));
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));
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;
}
*/
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;
}
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);
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;
*/
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,} };
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;
}
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;
}
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;
}
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);
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);
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);
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) {
{
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;
}
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;
}
{
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;
}
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;
}
/*! 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.
- *
- * \retval ast_format_cap object on success.
- * \retval NULL on failure.
- */
-struct ast_format_cap *ast_format_cap_alloc_nolock(void);
+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 with locking
- *
- * \note If no other form of locking is taking place, use this function.
- * This function makes most sense for globally accessible capabilities structures
- * that have no other means of locking.
+ * \brief Allocate a new ast_format_cap structure
*
+ * \param flags Modifiers of struct behavior.
* \retval ast_format_cap object on success.
* \retval NULL on failure.
*/
-struct ast_format_cap *ast_format_cap_alloc(void);
+struct ast_format_cap *ast_format_cap_alloc(enum ast_format_cap_flags flags);
/*!
* \brief Destroy an ast_format_cap structure.
static int recalling_enter(struct attended_transfer_properties *props)
{
- RAII_VAR(struct ast_format_cap *, cap, ast_format_cap_alloc_nolock(), ast_format_cap_destroy);
+ RAII_VAR(struct ast_format_cap *, cap, ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_NOLOCK), ast_format_cap_destroy);
struct ast_format fmt;
if (!cap) {
static int retransfer_enter(struct attended_transfer_properties *props)
{
- RAII_VAR(struct ast_format_cap *, cap, ast_format_cap_alloc_nolock(), ast_format_cap_destroy);
+ RAII_VAR(struct ast_format_cap *, cap, ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_NOLOCK), ast_format_cap_destroy);
struct ast_format fmt;
char destination[AST_MAX_EXTENSION + AST_MAX_CONTEXT + 2];
int cause;
const char *callback_sub = ast_get_cc_callback_sub(agent->cc_params);
unsigned int recall_timer = ast_get_cc_recall_timer(agent->cc_params) * 1000;
struct ast_format tmp_fmt;
- struct ast_format_cap *tmp_cap = ast_format_cap_alloc_nolock();
+ struct ast_format_cap *tmp_cap = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_NOLOCK);
if (!tmp_cap) {
return NULL;
ast_channel_stage_snapshot(tmp);
- if (!(nativeformats = ast_format_cap_alloc())) {
+ if (!(nativeformats = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_CACHE_STRINGS))) {
ao2_ref(tmp, -1);
/* format capabilities structure allocation failure */
return NULL;
int ast_set_read_format(struct ast_channel *chan, struct ast_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);
int res;
if (!cap) {
int ast_set_read_format_by_id(struct ast_channel *chan, enum ast_format_id id)
{
- 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 tmp_format;
int res;
int ast_set_write_format(struct ast_channel *chan, struct ast_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);
int res;
if (!cap) {
int ast_set_write_format_by_id(struct ast_channel *chan, enum ast_format_id id)
{
- 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 tmp_format;
int res;
return -1;
}
- if (!(local_tech.capabilities = ast_format_cap_alloc())) {
+ if (!(local_tech.capabilities = ast_format_cap_alloc(0))) {
return -1;
}
ast_format_cap_add_all(local_tech.capabilities);
} else if (chan) {
cap_request = ast_channel_nativeformats(chan);
} else {
- cap_all_audio = ast_format_cap_alloc_nolock();
+ cap_all_audio = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_NOLOCK);
ast_format_cap_add_all_by_type(cap_all_audio, AST_FORMAT_TYPE_AUDIO);
cap_request = cap_all_audio;
}
buflen = strlen(preflang) + strlen(filename) + 4;
buf = ast_alloca(buflen);
- if (!(file_fmt_cap = ast_format_cap_alloc_nolock())) {
+ if (!(file_fmt_cap = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_NOLOCK))) {
return NULL;
}
if (!fileexists_core(filename, NULL, preflang, buf, buflen, file_fmt_cap) ||
if (!ast_format_cap_has_type(ast_channel_nativeformats(chan), AST_FORMAT_TYPE_VIDEO)) {
return NULL;
}
- if (!(tmp_cap = ast_format_cap_alloc_nolock())) {
+ if (!(tmp_cap = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_NOLOCK))) {
return NULL;
}
/* Video is supported, so see what video formats exist for this file */
#include "asterisk/astobj2.h"
#include "asterisk/utils.h"
+#define FORMAT_STR_BUFSIZE 256
struct ast_format_cap {
/* The capabilities structure is just an ao2 container of ast_formats */
struct ao2_container *formats;
struct ao2_iterator it;
/*! TRUE if the formats container created without a lock. */
- int nolock;
+ struct ast_flags flags;
+ unsigned int string_cache_valid;
+ char format_strs[0];
};
/*! format exists within capabilities structure if it is identical to
return format->id;
}
-static struct ast_format_cap *cap_alloc_helper(int nolock)
+struct ast_format_cap *ast_format_cap_alloc(enum ast_format_cap_flags flags)
{
- struct ast_format_cap *cap = ast_calloc(1, sizeof(*cap));
+ struct ast_format_cap *cap;
+ unsigned int alloc_size;
+
+ alloc_size = sizeof(*cap);
+ if (flags & AST_FORMAT_CAP_FLAG_CACHE_STRINGS) {
+ alloc_size += FORMAT_STR_BUFSIZE;
+ }
+ cap = ast_calloc(1, alloc_size);
if (!cap) {
return NULL;
}
- cap->nolock = nolock;
+
+ ast_set_flag(&cap->flags, flags);
cap->formats = ao2_container_alloc_options(
- nolock ? AO2_ALLOC_OPT_LOCK_NOLOCK : AO2_ALLOC_OPT_LOCK_MUTEX,
- 283, hash_cb, cmp_cb);
+ (flags & AST_FORMAT_CAP_FLAG_NOLOCK) ?
+ AO2_ALLOC_OPT_LOCK_NOLOCK :
+ AO2_ALLOC_OPT_LOCK_MUTEX,
+ 11, hash_cb, cmp_cb);
if (!cap->formats) {
ast_free(cap);
return NULL;
return cap;
}
-struct ast_format_cap *ast_format_cap_alloc_nolock(void)
-{
- return cap_alloc_helper(1);
-}
-
-struct ast_format_cap *ast_format_cap_alloc(void)
-{
- return cap_alloc_helper(0);
-}
-
void *ast_format_cap_destroy(struct ast_format_cap *cap)
{
if (!cap) {
return NULL;
}
-void ast_format_cap_add(struct ast_format_cap *cap, const struct ast_format *format)
+static void format_cap_add(struct ast_format_cap *cap, const struct ast_format *format)
{
struct ast_format *fnew;
}
ast_format_copy(fnew, format);
ao2_link(cap->formats, fnew);
+
ao2_ref(fnew, -1);
}
+void ast_format_cap_add(struct ast_format_cap *cap, const struct ast_format *format)
+{
+ format_cap_add(cap, format);
+ cap->string_cache_valid = 0;
+}
+
void ast_format_cap_add_all_by_type(struct ast_format_cap *cap, enum ast_format_type type)
{
int x;
for (x = 0; x < f_len; x++) {
if (AST_FORMAT_GET_TYPE(f_list[x].format.id) == type) {
- ast_format_cap_add(cap, &f_list[x].format);
+ format_cap_add(cap, &f_list[x].format);
}
}
+ cap->string_cache_valid = 0;
ast_format_list_destroy(f_list);
}
const struct ast_format_list *f_list = ast_format_list_get(&f_len);
for (x = 0; x < f_len; x++) {
- ast_format_cap_add(cap, &f_list[x].format);
+ format_cap_add(cap, &f_list[x].format);
}
+ cap->string_cache_valid = 0;
ast_format_list_destroy(f_list);
}
struct ast_format *format = (struct ast_format *) obj;
if (!ast_format_cap_iscompatible(result, format)) {
- ast_format_cap_add(result, format);
+ format_cap_add(result, format);
}
return 0;
void ast_format_cap_append(struct ast_format_cap *dst, const struct ast_format_cap *src)
{
ao2_callback(src->formats, OBJ_NODATA, append_cb, dst);
+ dst->string_cache_valid = 0;
}
static int copy_cb(void *obj, void *arg, int flag)
struct ast_format_cap *result = (struct ast_format_cap *) arg;
struct ast_format *format = (struct ast_format *) obj;
- ast_format_cap_add(result, format);
+ format_cap_add(result, format);
return 0;
}
+static void format_cap_remove_all(struct ast_format_cap *cap)
+{
+ ao2_callback(cap->formats, OBJ_NODATA | OBJ_MULTIPLE | OBJ_UNLINK, NULL, NULL);
+}
+
void ast_format_cap_copy(struct ast_format_cap *dst, const struct ast_format_cap *src)
{
- ast_format_cap_remove_all(dst);
+ format_cap_remove_all(dst);
ao2_callback(src->formats, OBJ_NODATA, copy_cb, dst);
+ dst->string_cache_valid = 0;
}
struct ast_format_cap *ast_format_cap_dup(const struct ast_format_cap *cap)
{
struct ast_format_cap *dst;
- if (cap->nolock) {
- dst = ast_format_cap_alloc_nolock();
- } else {
- dst = ast_format_cap_alloc();
- }
+
+ dst = ast_format_cap_alloc(ast_test_flag(&cap->flags, AST_FLAGS_ALL));
if (!dst) {
return NULL;
}
ao2_callback(cap->formats, OBJ_NODATA, copy_cb, dst);
+ dst->string_cache_valid = 0;
return dst;
}
fremove = ao2_callback(cap->formats, OBJ_POINTER | OBJ_UNLINK, find_exact_cb, format);
if (fremove) {
ao2_ref(fremove, -1);
+ cap->string_cache_valid = 0;
return 0;
}
/* match_found will be set if at least one item was removed */
if (data.match_found) {
+ cap->string_cache_valid = 0;
return 0;
}
OBJ_UNLINK | OBJ_NODATA | OBJ_MULTIPLE,
multiple_by_type_cb,
&type);
+ cap->string_cache_valid = 0;
}
void ast_format_cap_remove_all(struct ast_format_cap *cap)
{
- ao2_callback(cap->formats, OBJ_NODATA | OBJ_MULTIPLE | OBJ_UNLINK, NULL, NULL);
+ format_cap_remove_all(cap);
+ cap->string_cache_valid = 0;
}
void ast_format_cap_set(struct ast_format_cap *cap, struct ast_format *format)
{
- ast_format_cap_remove_all(cap);
- ast_format_cap_add(cap, format);
+ format_cap_remove_all(cap);
+ format_cap_add(cap, format);
+ cap->string_cache_valid = 0;
}
int ast_format_cap_get_compatible_format(const struct ast_format_cap *cap, const struct ast_format *format, struct ast_format *result)
struct ast_format_cap *ast_format_cap_joint(const struct ast_format_cap *cap1, const struct ast_format_cap *cap2)
{
struct ao2_iterator it;
- struct ast_format_cap *result = ast_format_cap_alloc_nolock();
+ struct ast_format_cap *result = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_NOLOCK);
struct ast_format *tmp;
struct find_joint_data data = {
.joint_found = 0,
.joint_found = 0,
};
if (!append) {
- ast_format_cap_remove_all(result);
+ format_cap_remove_all(result);
}
it = ao2_iterator_init(cap1->formats, 0);
while ((tmp = ao2_iterator_next(&it))) {
}
ao2_iterator_destroy(&it);
+ result->string_cache_valid = 0;
+
return ao2_container_count(result->formats) ? 1 : 0;
}
struct ast_format_cap *ast_format_cap_get_type(const struct ast_format_cap *cap, enum ast_format_type ftype)
{
struct ao2_iterator it;
- struct ast_format_cap *result = ast_format_cap_alloc_nolock();
+ struct ast_format_cap *result = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_NOLOCK);
struct ast_format *tmp;
if (!result) {
return 0;
}
-char *ast_getformatname_multiple(char *buf, size_t size, struct ast_format_cap *cap)
+static char *getformatname_multiple(char *buf, size_t size, struct ast_format_cap *cap)
{
int x;
unsigned len;
return buf;
}
+char *ast_getformatname_multiple(char *buf, size_t size, struct ast_format_cap *cap)
+{
+ if (ast_test_flag(&cap->flags, AST_FORMAT_CAP_FLAG_CACHE_STRINGS)) {
+ if (!cap->string_cache_valid) {
+ getformatname_multiple(cap->format_strs, FORMAT_STR_BUFSIZE, cap);
+ cap->string_cache_valid = 1;
+ }
+ ast_copy_string(buf, cap->format_strs, size);
+ return buf;
+ }
+
+ return getformatname_multiple(buf, size, cap);
+}
+
uint64_t ast_format_cap_to_old_bitfield(const struct ast_format_cap *cap)
{
uint64_t res = 0;
int x;
struct ast_format tmp_format = { 0, };
- ast_format_cap_remove_all(dst);
+ format_cap_remove_all(dst);
for (x = 0; x < 64; x++) {
tmp = (1ULL << x);
if (tmp & src) {
- ast_format_cap_add(dst, ast_format_from_old_bitfield(&tmp_format, tmp));
+ format_cap_add(dst, ast_format_from_old_bitfield(&tmp_format, tmp));
}
}
+ dst->string_cache_valid = 0;
}
int reason = 0;
char tmp[256];
char tmp2[256];
- 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 tmp_fmt;
pthread_t th;
int bridge_early = 0;
return NULL;
}
- variant->formats = ast_format_cap_alloc();
+ variant->formats = ast_format_cap_alloc(0);
if (!variant->formats) {
return NULL;
}
struct ast_rtp_glue *glue0, *glue1;
enum ast_rtp_glue_result audio_glue0_res = AST_RTP_GLUE_RESULT_FORBID, video_glue0_res = AST_RTP_GLUE_RESULT_FORBID;
enum ast_rtp_glue_result audio_glue1_res = AST_RTP_GLUE_RESULT_FORBID, video_glue1_res = AST_RTP_GLUE_RESULT_FORBID;
- struct ast_format_cap *cap0 = ast_format_cap_alloc_nolock();
- struct ast_format_cap *cap1 = ast_format_cap_alloc_nolock();
+ struct ast_format_cap *cap0 = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_NOLOCK);
+ struct ast_format_cap *cap1 = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_NOLOCK);
/* Lock both channels so we can look for the glue that binds them together */
ast_channel_lock_both(c0, c1);
struct ast_rtp_glue *glue0, *glue1;
enum ast_rtp_glue_result audio_glue0_res = AST_RTP_GLUE_RESULT_FORBID, video_glue0_res = AST_RTP_GLUE_RESULT_FORBID;
enum ast_rtp_glue_result audio_glue1_res = AST_RTP_GLUE_RESULT_FORBID, video_glue1_res = AST_RTP_GLUE_RESULT_FORBID;
- struct ast_format_cap *cap0 = ast_format_cap_alloc_nolock();
- struct ast_format_cap *cap1 = ast_format_cap_alloc_nolock();
+ struct ast_format_cap *cap0 = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_NOLOCK);
+ struct ast_format_cap *cap1 = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_NOLOCK);
/* If there is no second channel just immediately bail out, we are of no use in that scenario */
if (!c1 || !cap1 || !cap0) {
return NULL;
}
- o->capabilities = ast_format_cap_alloc_nolock();
+ o->capabilities = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_NOLOCK);
if (!o->capabilities) {
free_outgoing(o);
return NULL;
RAII_VAR(struct ast_format_cap *, cap, NULL, ast_format_cap_destroy);
struct ast_format format;
- cap = ast_format_cap_alloc_nolock();
+ cap = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_NOLOCK);
if (!cap) {
return NULL;
}
struct ast_channel *dchan;
struct outgoing_helper oh = { 0, };
int outstate;
- 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);
char buf[13];
char *dial_tech;
char *cur_announce;
return RESULT_SUCCESS;
}
- if (!(cap = ast_format_cap_alloc_nolock())) {
+ if (!(cap = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_NOLOCK))) {
return RESULT_FAILURE;
}
ast_format_cap_add(cap, ast_format_set(&tmpfmt, AST_FORMAT_SLINEAR, 0));
return CLI_SHOWUSAGE;
}
- if (!(cap = ast_format_cap_alloc_nolock())) {
+ if (!(cap = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_NOLOCK))) {
return CLI_FAILURE;
}
ast_format_cap_add(cap, ast_format_set(&tmpfmt, AST_FORMAT_SLINEAR, 0));
exten = "s";
if (ast_strlen_zero(context))
context = "default";
- if (!(cap = ast_format_cap_alloc_nolock())) {
+ if (!(cap = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_NOLOCK))) {
return CLI_FAILURE;
}
ast_format_cap_add(cap, ast_format_set(&tmpfmt, AST_FORMAT_SLINEAR, 0));
ao2_cleanup(endpoint);
return NULL;
}
- if (!(endpoint->media.codecs = ast_format_cap_alloc_nolock())) {
+ if (!(endpoint->media.codecs = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_NOLOCK))) {
ao2_cleanup(endpoint);
return NULL;
}
int direct_media_enabled = !ast_sockaddr_isnull(&session_media->direct_media_addr) &&
!ast_format_cap_is_empty(session->direct_media_cap);
- if (!(caps = ast_format_cap_alloc_nolock()) ||
- !(peer = ast_format_cap_alloc_nolock())) {
+ if (!(caps = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_NOLOCK)) ||
+ !(peer = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_NOLOCK))) {
ast_log(LOG_ERROR, "Failed to allocate %s capabilities\n", session_media->stream_type);
return -1;
}
/* Add ICE attributes and candidates */
add_ice_to_stream(session, session_media, pool, media);
- if (!(caps = ast_format_cap_alloc_nolock())) {
+ if (!(caps = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_NOLOCK))) {
ast_log(LOG_ERROR, "Failed to allocate %s capabilities\n", session_media->stream_type);
return -1;
}
ao2_ref(endpoint, +1);
session->endpoint = endpoint;
session->inv_session = inv_session;
- session->req_caps = ast_format_cap_alloc_nolock();
+ session->req_caps = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_NOLOCK);
if (endpoint->dtmf == AST_SIP_DTMF_INBAND) {
dsp_features |= DSP_FEATURE_DIGIT_DETECT;
iter->session_begin(session);
}
}
- session->direct_media_cap = ast_format_cap_alloc_nolock();
+ session->direct_media_cap = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_NOLOCK);
AST_LIST_HEAD_INIT_NOLOCK(&session->delayed_requests);
ast_party_id_init(&session->id);
ao2_ref(session, +1);
RAII_VAR(struct ast_format_cap *, cap, NULL, ast_format_cap_destroy);
struct ast_format format;
- cap = ast_format_cap_alloc_nolock();
+ cap = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_NOLOCK);
if (!cap) {
return NULL;
}
ao2_ref(item, -1);
return NULL;
}
- if (!(item->codeccapopt = ast_format_cap_alloc())) {
+ if (!(item->codeccapopt = ast_format_cap_alloc(0))) {
ao2_ref(item, -1);
return NULL;
}
ast_sockaddr_parse(&acl_allow, "1.2.3.4", PARSE_PORT_FORBID);
ast_sockaddr_parse(&acl_fail, "1.1.1.1", PARSE_PORT_FORBID);
- defaults.codeccapopt = ast_format_cap_alloc();
+ defaults.codeccapopt = ast_format_cap_alloc(0);
ast_parse_allow_disallow(&defaults.codecprefopt, defaults.codeccapopt, CODEC_DEFAULT, 1);
- configs.codeccapopt = ast_format_cap_alloc();
+ configs.codeccapopt = ast_format_cap_alloc(0);
ast_parse_allow_disallow(&configs.codecprefopt, configs.codeccapopt, CODEC_CONFIG, 1);
ast_string_field_init(&defaults, 128);
break;
}
- cap1 = ast_format_cap_alloc_nolock();
- cap2 = ast_format_cap_alloc_nolock();
+ cap1 = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_NOLOCK);
+ cap2 = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_NOLOCK);
if (!cap1 || !cap2) {
ast_test_status_update(test, "cap alloc failed.\n");
break;
}
- cap1 = ast_format_cap_alloc();
- cap2 = ast_format_cap_alloc();
+ cap1 = ast_format_cap_alloc(0);
+ cap2 = ast_format_cap_alloc(0);
if (!cap1 || !cap2) {
ast_test_status_update(test, "cap alloc failed.\n");
break;
}
- cap = ast_format_cap_alloc_nolock();
+ cap = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_NOLOCK);
if (!cap) {
ast_test_status_update(test, "alloc failed\n");
return AST_TEST_FAIL;
break;
}
- cap = ast_format_cap_alloc();
+ cap = ast_format_cap_alloc(0);
if (!cap) {
ast_test_status_update(test, "alloc failed\n");
return AST_TEST_FAIL;
for (x = 0; x < 2000; x++) {
if (nolocking) {
- cap1 = ast_format_cap_alloc_nolock();
- cap2 = ast_format_cap_alloc_nolock();
- joint = ast_format_cap_alloc_nolock();
+ cap1 = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_NOLOCK);
+ cap2 = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_NOLOCK);
+ joint = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_NOLOCK);
} else {
- cap1 = ast_format_cap_alloc();
- cap2 = ast_format_cap_alloc();
- joint = ast_format_cap_alloc();
+ cap1 = ast_format_cap_alloc(0);
+ cap2 = ast_format_cap_alloc(0);
+ joint = ast_format_cap_alloc(0);
}
if (!cap1 || !cap2 || !joint) {
ast_test_status_update(test, "cap alloc fail\n");