[svn-commits] file: branch file/mf-attributes r417769 - in /team/file/mf-attributes: includ...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Wed Jul 2 14:23:19 CDT 2014


Author: file
Date: Wed Jul  2 14:23:16 2014
New Revision: 417769

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=417769
Log:
Incorporate feedback.

Modified:
    team/file/mf-attributes/include/asterisk/format.h
    team/file/mf-attributes/main/format.c

Modified: team/file/mf-attributes/include/asterisk/format.h
URL: http://svnview.digium.com/svn/asterisk/team/file/mf-attributes/include/asterisk/format.h?view=diff&rev=417769&r1=417768&r2=417769
==============================================================================
--- team/file/mf-attributes/include/asterisk/format.h (original)
+++ team/file/mf-attributes/include/asterisk/format.h Wed Jul  2 14:23:16 2014
@@ -165,8 +165,7 @@
  *
  * \param format The existing media format
  *
- * \note The format is returned with reference count incremented. It must be released using
- * ao2_ref or ao2_cleanup.
+ * \note The returned format is a new ao2 object. It must be released using ao2_cleanup.
  *
  * \retval non-NULL success
  * \retval NULL failure

Modified: team/file/mf-attributes/main/format.c
URL: http://svnview.digium.com/svn/asterisk/team/file/mf-attributes/main/format.c?view=diff&rev=417769&r1=417768&r2=417769
==============================================================================
--- team/file/mf-attributes/main/format.c (original)
+++ team/file/mf-attributes/main/format.c Wed Jul  2 14:23:16 2014
@@ -127,6 +127,11 @@
 	SCOPED_AO2WRLOCK(lock, interfaces);
 	struct format_interface *format_interface;
 
+	if (!interface->format_clone || !interface->format_destroy) {
+		ast_log(LOG_ERROR, "Format interface for codec '%s' does not implement required callbacks\n", codec);
+		return -1;
+	}
+
 	format_interface = ao2_find(interfaces, codec, OBJ_SEARCH_KEY | OBJ_NOLOCK);
 	if (format_interface) {
 		ast_log(LOG_ERROR, "A format interface is already present for codec '%s'\n", codec);
@@ -273,7 +278,7 @@
 	}
 
 	if (!interface || !interface->format_attribute_set) {
-		return ast_format_clone(format);
+		return ao2_bump((struct ast_format*)format);
 	}
 
 	return interface->format_attribute_set(format, name, value);
@@ -292,7 +297,7 @@
 	}
 
 	if (!interface || !interface->format_sdp_parse) {
-		return ast_format_clone(format);
+		return ao2_bump((struct ast_format*)format);
 	}
 
 	return interface->format_sdp_parse(format, attributes);




More information about the svn-commits mailing list