[asterisk-commits] dvossel: branch dvossel/fixtheworld_phase1_step3 r303986 - /team/dvossel/fixt...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Jan 25 16:22:44 CST 2011


Author: dvossel
Date: Tue Jan 25 16:22:40 2011
New Revision: 303986

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=303986
Log:
Fixes an error in the iax2 old format bitfield conversion layer

Modified:
    team/dvossel/fixtheworld_phase1_step3/main/format.c
    team/dvossel/fixtheworld_phase1_step3/main/format_pref.c

Modified: team/dvossel/fixtheworld_phase1_step3/main/format.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/fixtheworld_phase1_step3/main/format.c?view=diff&rev=303986&r1=303985&r2=303986
==============================================================================
--- team/dvossel/fixtheworld_phase1_step3/main/format.c (original)
+++ team/dvossel/fixtheworld_phase1_step3/main/format.c Tue Jan 25 16:22:40 2011
@@ -480,7 +480,7 @@
 enum ast_format_id ast_format_id_from_old_bitfield(uint64_t src)
 {
 	struct ast_format dst;
-	if (ast_format_from_old_bitfield(&dst, src), 0) {
+	if (ast_format_from_old_bitfield(&dst, src)) {
 		return dst.id;
 	}
 	return 0;

Modified: team/dvossel/fixtheworld_phase1_step3/main/format_pref.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/fixtheworld_phase1_step3/main/format_pref.c?view=diff&rev=303986&r1=303985&r2=303986
==============================================================================
--- team/dvossel/fixtheworld_phase1_step3/main/format_pref.c (original)
+++ team/dvossel/fixtheworld_phase1_step3/main/format_pref.c Tue Jan 25 16:22:40 2011
@@ -33,6 +33,8 @@
 
 void ast_codec_pref_convert(struct ast_codec_pref *pref, char *buf, size_t size, int right)
 {
+	size_t f_len;
+	const struct ast_format_list *f_list = ast_get_format_list(&f_len);
 	int x, differential = (int) 'A', mem;
 	char *from, *to;
 
@@ -50,9 +52,13 @@
 
 	memset(to, 0, mem);
 	for (x = 0; x < AST_CODEC_PREF_SIZE; x++) {
-		if (!from[x])
-			break;
+		if (!from[x]) {
+			break;
+		}
 		to[x] = right ? (from[x] + differential) : (from[x] - differential);
+		if (!right && to[x] && (to[x] < f_len)) {
+			ast_format_set(&pref->formats[x], f_list[to[x]-1].id , 0);
+		}
 	}
 }
 




More information about the asterisk-commits mailing list