[asterisk-commits] dvossel: branch dvossel/fixtheworld_phase2 r308204 - /team/dvossel/fixtheworl...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu Feb 17 10:42:56 CST 2011
Author: dvossel
Date: Thu Feb 17 10:42:53 2011
New Revision: 308204
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=308204
Log:
Replaces duplicate logic with API call
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=308204&r1=308203&r2=308204
==============================================================================
--- team/dvossel/fixtheworld_phase2/main/channel.c (original)
+++ team/dvossel/fixtheworld_phase2/main/channel.c Thu Feb 17 10:42:53 2011
@@ -5796,26 +5796,8 @@
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 >= 192000) {
- ast_format_set(&best_dst_fmt, AST_FORMAT_SLINEAR192, 0);
- } else if (best_sample_rate >= 96000) {
- ast_format_set(&best_dst_fmt, AST_FORMAT_SLINEAR96, 0);
- } else if (best_sample_rate >= 48000) {
- ast_format_set(&best_dst_fmt, AST_FORMAT_SLINEAR48, 0);
- } else if (best_sample_rate >= 44100) {
- ast_format_set(&best_dst_fmt, AST_FORMAT_SLINEAR44, 0);
- } else if (best_sample_rate >= 32000) {
- ast_format_set(&best_dst_fmt, AST_FORMAT_SLINEAR32, 0);
- } else if (best_sample_rate >= 24000) {
- ast_format_set(&best_dst_fmt, AST_FORMAT_SLINEAR24, 0);
- } else if (best_sample_rate >= 16000) {
- ast_format_set(&best_dst_fmt, AST_FORMAT_SLINEAR16, 0);
- } else if (best_sample_rate >= 12000) {
- ast_format_set(&best_dst_fmt, AST_FORMAT_SLINEAR12, 0);
- } else {
- ast_format_set(&best_dst_fmt, AST_FORMAT_SLINEAR, 0);
- }
+ /* pick the best signed linear format based upon what preserves the sample rate the best. */
+ ast_format_set(&best_dst_fmt, ast_format_slin_by_rate(best_sample_rate), 0);
}
if (ast_set_read_format(from, &best_dst_fmt) < 0) {
More information about the asterisk-commits
mailing list