[asterisk-commits] file: trunk r370927 - /trunk/main/rtp_engine.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Aug 8 15:47:33 CDT 2012


Author: file
Date: Wed Aug  8 15:47:29 2012
New Revision: 370927

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=370927
Log:
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.

Modified:
    trunk/main/rtp_engine.c

Modified: trunk/main/rtp_engine.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/rtp_engine.c?view=diff&rev=370927&r1=370926&r2=370927
==============================================================================
--- trunk/main/rtp_engine.c (original)
+++ trunk/main/rtp_engine.c Wed Aug  8 15:47:29 2012
@@ -534,9 +534,19 @@
 	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;




More information about the asterisk-commits mailing list