static int rtp_payload_type_hash(const void *obj, const int flags)
{
const struct ast_rtp_payload_type *type = obj;
- const int *rtp_code = obj;
+ const int *payload = obj;
- return (flags & OBJ_KEY) ? *rtp_code : type->rtp_code;
+ return (flags & OBJ_KEY) ? *payload : type->payload;
}
static int rtp_payload_type_cmp(void *obj, void *arg, int flags)
{
struct ast_rtp_payload_type *type1 = obj, *type2 = arg;
- const int *rtp_code = arg;
+ const int *payload = arg;
- return (type1->rtp_code == (OBJ_KEY ? *rtp_code : type2->rtp_code)) ? CMP_MATCH | CMP_STOP : 0;
+ return (type1->payload == (OBJ_KEY ? *payload : type2->payload)) ? CMP_MATCH | CMP_STOP : 0;
}
int ast_rtp_codecs_payloads_initialize(struct ast_rtp_codecs *codecs)
continue;
}
+ type->payload = i;
type->asterisk_format = static_RTP_PT[i].asterisk_format;
type->rtp_code = static_RTP_PT[i].rtp_code;
ast_format_copy(&type->format, &static_RTP_PT[i].format);
ast_debug(2, "Copying payload %d from %p to %p\n", i, src, dest);
+ new_type->payload = i;
*new_type = *type;
ao2_link_flags(dest->payloads, new_type, OBJ_NOLOCK);
type->asterisk_format = static_RTP_PT[payload].asterisk_format;
type->rtp_code = static_RTP_PT[payload].rtp_code;
+ type->payload = payload;
ast_format_copy(&type->format, &static_RTP_PT[payload].format);
ast_debug(1, "Setting payload %d based on m type on %p\n", payload, codecs);
if (!(type = ao2_alloc(sizeof(*type), NULL))) {
continue;
}
- type->rtp_code = pt;
+ type->payload = pt;
ao2_link_flags(codecs->payloads, type, OBJ_NOLOCK);
}
*type = t->payload_type;
- type->rtp_code = pt;
+ type->payload = pt;
if ((t->payload_type.format.id == AST_FORMAT_G726) && t->payload_type.asterisk_format && (options & AST_RTP_OPT_G726_NONSTANDARD)) {
ast_format_set(&type->format, AST_FORMAT_G726_AAL2, 0);
int i, res = -1;
if (asterisk_format && format && (type = ao2_callback(codecs->payloads, OBJ_NOLOCK, rtp_payload_type_find_format, (void*)format))) {
- res = type->rtp_code;
+ res = type->payload;
ao2_ref(type, -1);
return res;
} else if (!asterisk_format && (type = ao2_find(codecs->payloads, &code, OBJ_NOLOCK | OBJ_KEY))) {
- res = type->rtp_code;
+ res = type->payload;
ao2_ref(type, -1);
return res;
}