[asterisk-commits] dvossel: branch dvossel/fixtheworld_phase2 r306956 - /team/dvossel/fixtheworl...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Feb 8 12:36:24 CST 2011


Author: dvossel
Date: Tue Feb  8 12:36:20 2011
New Revision: 306956

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=306956
Log:
When using slin for intermediate translation, make sure the slin with the best rate is used

Modified:
    team/dvossel/fixtheworld_phase2/main/channel.c

Modified: team/dvossel/fixtheworld_phase2/main/channel.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/fixtheworld_phase2/main/channel.c?view=diff&rev=306956&r1=306955&r2=306956
==============================================================================
--- team/dvossel/fixtheworld_phase2/main/channel.c (original)
+++ team/dvossel/fixtheworld_phase2/main/channel.c Tue Feb  8 12:36:20 2011
@@ -5785,7 +5785,15 @@
 		(ast_opt_generic_plc || ast_opt_transcode_via_slin) &&
 	    (ast_translate_path_steps(&best_dst_fmt, &best_src_fmt) != 1 || use_slin)) {
 
-		ast_format_set(&best_dst_fmt, AST_FORMAT_SLINEAR, 0);
+		int best_sample_rate = ast_format_rate(&best_src_fmt) > ast_format_rate(&best_dst_fmt) ?
+			ast_format_rate(&best_src_fmt) : ast_format_rate(&best_dst_fmt);
+
+		/* pick the best signed linear format based upon what preserves the sample rate the best. */ 
+		if (best_sample_rate >= 16000) {
+			ast_format_set(&best_dst_fmt, AST_FORMAT_SLINEAR16, 0);
+		} else {
+			ast_format_set(&best_dst_fmt, AST_FORMAT_SLINEAR16, 0);
+		}
 	}
 
 	if (ast_set_read_format(from, &best_dst_fmt) < 0) {




More information about the asterisk-commits mailing list