[asterisk-commits] kmoore: branch group/media_formats-reviewed-trunk r418651 - /team/group/media...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Jul 15 12:46:22 CDT 2014


Author: kmoore
Date: Tue Jul 15 12:46:19 2014
New Revision: 418651

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=418651
Log:
media formats: Add missing piece of r418615

Modified:
    team/group/media_formats-reviewed-trunk/res/res_pjsip_session.c

Modified: team/group/media_formats-reviewed-trunk/res/res_pjsip_session.c
URL: http://svnview.digium.com/svn/asterisk/team/group/media_formats-reviewed-trunk/res/res_pjsip_session.c?view=diff&rev=418651&r1=418650&r2=418651
==============================================================================
--- team/group/media_formats-reviewed-trunk/res/res_pjsip_session.c (original)
+++ team/group/media_formats-reviewed-trunk/res/res_pjsip_session.c Tue Jul 15 12:46:19 2014
@@ -1274,8 +1274,18 @@
 	}
 
 	if (ast_format_cap_count(req_caps)) {
-		ast_format_cap_append_from_cap(session->req_caps, session->endpoint->media.codecs, AST_MEDIA_TYPE_UNKNOWN);
-		ast_format_cap_append_from_cap(session->req_caps, req_caps, AST_MEDIA_TYPE_UNKNOWN);
+		/* get joint caps between req_caps and endpoint caps */
+		struct ast_format_cap *joint_caps = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_DEFAULT);
+		ast_format_cap_get_compatible(req_caps, session->endpoint->media.codecs, joint_caps);
+
+		/* if joint caps */
+		if (ast_format_cap_count(joint_caps)) {
+			/* copy endpoint caps into session->req_caps */
+			ast_format_cap_append_from_cap(session->req_caps, session->endpoint->media.codecs, AST_MEDIA_TYPE_UNKNOWN);
+			/* replace instances of joint caps equivalents in session->req_caps */
+			ast_format_cap_replace_from_cap(session->req_caps, joint_caps, AST_MEDIA_TYPE_UNKNOWN);
+		}
+		ao2_cleanup(joint_caps);
 	}
 
 	if ((pjsip_dlg_add_usage(dlg, &session_module, NULL) != PJ_SUCCESS)) {




More information about the asterisk-commits mailing list