[svn-commits] file: branch file/media-attrib-sdp r368874 - in /team/file/media-attrib-sdp: ...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Wed Jun 13 14:08:34 CDT 2012


Author: file
Date: Wed Jun 13 14:08:30 2012
New Revision: 368874

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=368874
Log:
Fix two places (so far) where attribute information would get lost or not used.

Modified:
    team/file/media-attrib-sdp/channels/chan_sip.c
    team/file/media-attrib-sdp/main/translate.c

Modified: team/file/media-attrib-sdp/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/file/media-attrib-sdp/channels/chan_sip.c?view=diff&rev=368874&r1=368873&r2=368874
==============================================================================
--- team/file/media-attrib-sdp/channels/chan_sip.c (original)
+++ team/file/media-attrib-sdp/channels/chan_sip.c Wed Jun 13 14:08:30 2012
@@ -12030,10 +12030,12 @@
 
 		/* Start by sending our preferred audio/video codecs */
 		for (x = 0; x < AST_CODEC_PREF_SIZE; x++) {
-			if (!(ast_codec_pref_index(&p->prefs, x, &tmp_fmt)))
+			struct ast_format pref;
+
+			if (!(ast_codec_pref_index(&p->prefs, x, &pref)))
 				break;
 
-			if (!(ast_format_cap_iscompatible(tmpcap, &tmp_fmt)))
+			if (!ast_format_cap_get_compatible_format(tmpcap, &pref, &tmp_fmt))
 				continue;
 
 			if (ast_format_cap_iscompatible(alreadysent, &tmp_fmt))

Modified: team/file/media-attrib-sdp/main/translate.c
URL: http://svnview.digium.com/svn/asterisk/team/file/media-attrib-sdp/main/translate.c?view=diff&rev=368874&r1=368873&r2=368874
==============================================================================
--- team/file/media-attrib-sdp/main/translate.c (original)
+++ team/file/media-attrib-sdp/main/translate.c Wed Jun 13 14:08:30 2012
@@ -1282,12 +1282,22 @@
 void ast_translate_available_formats(struct ast_format_cap *dest, struct ast_format_cap *src, struct ast_format_cap *result)
 {
 	struct ast_format tmp_fmt;
-	struct ast_format cur_src;
+	struct ast_format cur_dest, cur_src;
 	int src_audio = 0;
 	int src_video = 0;
 	int index;
 
-	ast_format_cap_copy(result, dest);
+	ast_format_cap_iter_start(dest);
+	while (!ast_format_cap_iter_next(dest, &cur_dest)) {
+		/* We give preference to a joint format structure if possible */
+		if (ast_format_cap_get_compatible_format(src, &cur_dest, &tmp_fmt)) {
+			ast_format_cap_add(result, &tmp_fmt);
+		} else {
+			/* Otherwise we just use the destination format */
+			ast_format_cap_add(result, &cur_dest);
+		}
+	}
+	ast_format_cap_iter_end(dest);
 
 	/* if we don't have a source format, we just have to try all
 	   possible destination formats */




More information about the svn-commits mailing list