提交 a66ef851 authored 作者: Michael Jerris's avatar Michael Jerris

fix linefeeds

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@234 d0543943-73ff-0310-b7d9-9358b9ac24b2
上级 50a65440
...@@ -34,13 +34,13 @@ ...@@ -34,13 +34,13 @@
static const char modname[] = "mod_rawaudio"; static const char modname[] = "mod_rawaudio";
#ifndef MIN #ifndef MIN
#define MIN(a,b) ((a) < (b) ? (a) : (b)) #define MIN(a,b) ((a) < (b) ? (a) : (b))
#endif #endif
#ifndef MAX #ifndef MAX
#define MAX(a,b) ((a) > (b) ? (a) : (b)) #define MAX(a,b) ((a) > (b) ? (a) : (b))
#endif #endif
struct raw_context { struct raw_context {
void *enc_resampler; void *enc_resampler;
...@@ -54,23 +54,23 @@ struct raw_context { ...@@ -54,23 +54,23 @@ struct raw_context {
}; };
static int resample(void *handle, double factor, float *src, int srclen, float *dst, int dstlen, int last) static int resample(void *handle, double factor, float *src, int srclen, float *dst, int dstlen, int last)
{ {
int o=0, srcused=0, srcpos=0, out=0; int o=0, srcused=0, srcpos=0, out=0;
for(;;) { for(;;) {
int srcBlock = MIN(srclen-srcpos, srclen); int srcBlock = MIN(srclen-srcpos, srclen);
int lastFlag = (last && (srcBlock == srclen-srcpos)); int lastFlag = (last && (srcBlock == srclen-srcpos));
printf("resampling %d/%d (%d)\n", srcpos, srclen, MIN(dstlen-out, dstlen)); printf("resampling %d/%d (%d)\n", srcpos, srclen, MIN(dstlen-out, dstlen));
o = resample_process(handle, factor, &src[srcpos], srcBlock, lastFlag, &srcused, &dst[out], dstlen-out); o = resample_process(handle, factor, &src[srcpos], srcBlock, lastFlag, &srcused, &dst[out], dstlen-out);
srcpos += srcused; srcpos += srcused;
if (o >= 0) if (o >= 0)
out += o; out += o;
if (o < 0 || (o == 0 && srcpos == srclen)) if (o < 0 || (o == 0 && srcpos == srclen))
break; break;
} }
return out; return out;
} }
static switch_status switch_raw_init(switch_codec *codec, switch_codec_flag flags, const struct switch_codec_settings *codec_settings) static switch_status switch_raw_init(switch_codec *codec, switch_codec_flag flags, const struct switch_codec_settings *codec_settings)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论