mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-04 11:58:52 +00:00
Create the payload type if it does not exist when setting information based on the 'm' line. An rtpmap attribute is not required for defined payload numbers.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@370927 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -534,11 +534,21 @@ void ast_rtp_codecs_payloads_set_m_type(struct ast_rtp_codecs *codecs, struct as
|
||||
struct ast_rtp_payload_type *type;
|
||||
|
||||
ast_rwlock_rdlock(&static_RTP_PT_lock);
|
||||
if (payload < 0 || payload >= AST_RTP_MAX_PT || !(type = ao2_find(codecs->payloads, &payload, OBJ_KEY | OBJ_NOLOCK))) {
|
||||
|
||||
if (payload < 0 || payload >= AST_RTP_MAX_PT) {
|
||||
ast_rwlock_unlock(&static_RTP_PT_lock);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!(type = ao2_find(codecs->payloads, &payload, OBJ_KEY | OBJ_NOLOCK))) {
|
||||
if (!(type = ao2_alloc(sizeof(*type), NULL))) {
|
||||
ast_rwlock_unlock(&static_RTP_PT_lock);
|
||||
return;
|
||||
}
|
||||
type->payload = payload;
|
||||
ao2_link_flags(codecs->payloads, type, OBJ_NOLOCK);
|
||||
}
|
||||
|
||||
type->asterisk_format = static_RTP_PT[payload].asterisk_format;
|
||||
type->rtp_code = static_RTP_PT[payload].rtp_code;
|
||||
type->payload = payload;
|
||||
|
Reference in New Issue
Block a user