[asterisk-commits] seanbright: branch 13 r431267 - /branches/13/res/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Jan 28 06:18:21 CST 2015


Author: seanbright
Date: Wed Jan 28 06:18:14 2015
New Revision: 431267

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=431267
Log:
media formats: update res_format_attr_opus & silk

In r419044, we changed how formats were handled, but the return value
of the format_parse_sdp_fmtp functions in res_format_attr_opus and
res_format_attr_silk were not updated, causing calls to fail.  Ran
into this when getting codec_opus working with Asterisk 13.

Once the return value was corrected, we were crashing in opus_getjoint
because of NULL format attributes.  I've fixed this as well in this
patch.

Modified:
    branches/13/res/res_format_attr_opus.c
    branches/13/res/res_format_attr_silk.c

Modified: branches/13/res/res_format_attr_opus.c
URL: http://svnview.digium.com/svn/asterisk/branches/13/res/res_format_attr_opus.c?view=diff&rev=431267&r1=431266&r2=431267
==============================================================================
--- branches/13/res/res_format_attr_opus.c (original)
+++ branches/13/res/res_format_attr_opus.c Wed Jan 28 06:18:14 2015
@@ -51,6 +51,12 @@
 	unsigned int spropstereo;	        /* Default 0 */
 };
 
+static struct opus_attr default_opus_attr = {
+	.fec    = 0,
+	.dtx    = 0,
+	.stereo = 0,
+};
+
 static void opus_destroy(struct ast_format *format)
 {
 	struct opus_attr *attr = ast_format_get_attribute_data(format);
@@ -120,7 +126,7 @@
 		attr->dtx = val;
 	}
 
-	return 0;
+	return cloned;
 }
 
 static void opus_generate_sdp_fmtp(const struct ast_format *format, unsigned int payload, struct ast_str **str)
@@ -163,6 +169,14 @@
 	struct ast_format *jointformat;
 	struct opus_attr *attr_res;
 
+	if (!attr1) {
+		attr1 = &default_opus_attr;
+	}
+
+	if (!attr2) {
+		attr2 = &default_opus_attr;
+	}
+
 	jointformat = ast_format_clone(format1);
 	if (!jointformat) {
 		return NULL;

Modified: branches/13/res/res_format_attr_silk.c
URL: http://svnview.digium.com/svn/asterisk/branches/13/res/res_format_attr_silk.c?view=diff&rev=431267&r1=431266&r2=431267
==============================================================================
--- branches/13/res/res_format_attr_silk.c (original)
+++ branches/13/res/res_format_attr_silk.c Wed Jan 28 06:18:14 2015
@@ -94,7 +94,7 @@
 		attr->fec = val;
 	}
 
-	return 0;
+	return cloned;
 }
 
 static void silk_generate_sdp_fmtp(const struct ast_format *format, unsigned int payload, struct ast_str **str)




More information about the asterisk-commits mailing list