[svn-commits] mmichelson: branch 11 r372311 - in /branches/11: include/asterisk/ main/ res/

SVN commits to the Digium repositories svn-commits at lists.digium.com
Wed Sep 5 11:04:44 CDT 2012


Author: mmichelson
Date: Wed Sep  5 11:04:40 2012
New Revision: 372311

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=372311
Log:
Re-fix sending unnegotiated payloads during a P2P RTP bridge.

The previous fix still would look in the static_RTP_PT table, which
is inappropriate since we specifically want to find a codec that has
been negotiated.

(closes issue ASTERISK-20296)
reported by NITESH BANSAL
Patches:
	codec_negotiation.patch Uploaded by NITESH BANSAL (License #6418)


Modified:
    branches/11/include/asterisk/rtp_engine.h
    branches/11/main/rtp_engine.c
    branches/11/res/res_rtp_asterisk.c

Modified: branches/11/include/asterisk/rtp_engine.h
URL: http://svnview.digium.com/svn/asterisk/branches/11/include/asterisk/rtp_engine.h?view=diff&rev=372311&r1=372310&r2=372311
==============================================================================
--- branches/11/include/asterisk/rtp_engine.h (original)
+++ branches/11/include/asterisk/rtp_engine.h Wed Sep  5 11:04:40 2012
@@ -1216,6 +1216,24 @@
  * \since 1.8
  */
 int ast_rtp_codecs_payload_code(struct ast_rtp_codecs *codecs, int asterisk_format, const struct ast_format *format, int code);
+/*!
+ * \brief Search for a payload code in the ast_rtp_codecs structure
+ *
+ * \param codecs Codecs structure to look in
+ * \param code The format to look for
+ *
+ * \retval Numerical payload or -1 if unable to find payload in codecs
+ *
+ * Example usage:
+ *
+ * \code
+ * int payload = ast_rtp_codecs_payload_code(&codecs, 0);
+ * \endcode
+ *
+ * This looks for the numerical payload for ULAW in the codecs structure.
+ *
+ */
+int ast_rtp_codecs_find_payload_code(struct ast_rtp_codecs *codecs, int code);
 
 /*!
  * \brief Retrieve mime subtype information on a payload

Modified: branches/11/main/rtp_engine.c
URL: http://svnview.digium.com/svn/asterisk/branches/11/main/rtp_engine.c?view=diff&rev=372311&r1=372310&r2=372311
==============================================================================
--- branches/11/main/rtp_engine.c (original)
+++ branches/11/main/rtp_engine.c Wed Sep  5 11:04:40 2012
@@ -762,7 +762,21 @@
 
 	return res;
 }
-
+int ast_rtp_codecs_find_payload_code(struct ast_rtp_codecs *codecs, int code)
+{
+	struct ast_rtp_payload_type *type;
+	int res = -1;
+
+	/* Search the payload type in the codecs passed */
+	if ((type = ao2_find(codecs->payloads, &code, OBJ_NOLOCK | OBJ_KEY)))
+	{
+		res = type->payload;
+		ao2_ref(type, -1);
+		return res;
+	}
+
+	return res;
+}
 const char *ast_rtp_lookup_mime_subtype2(const int asterisk_format, struct ast_format *format, int code, enum ast_rtp_options options)
 {
 	int i;

Modified: branches/11/res/res_rtp_asterisk.c
URL: http://svnview.digium.com/svn/asterisk/branches/11/res/res_rtp_asterisk.c?view=diff&rev=372311&r1=372310&r2=372311
==============================================================================
--- branches/11/res/res_rtp_asterisk.c (original)
+++ branches/11/res/res_rtp_asterisk.c Wed Sep  5 11:04:40 2012
@@ -2790,8 +2790,9 @@
 	}
 
 	/* If the payload coming in is not one of the negotiated ones then send it to the core, this will cause formats to change and the bridge to break */
-	if ((ast_rtp_codecs_payload_code(ast_rtp_instance_get_codecs(instance1), 0, NULL, bridged_payload) == -1) &&
-	    !ast_rtp_codecs_get_payload_format(ast_rtp_instance_get_codecs(instance1), bridged_payload)) {
+	if (ast_rtp_codecs_find_payload_code(ast_rtp_instance_get_codecs(instance1),bridged_payload) == -1)
+	{
+		ast_debug(1, "Unsupported payload type received \n");
 		return -1;
 	}
 




More information about the svn-commits mailing list