Chromium Code Reviews| Index: webrtc/modules/audio_processing/aec/aec_resampler.cc |
| diff --git a/webrtc/modules/audio_processing/aec/aec_resampler.c b/webrtc/modules/audio_processing/aec/aec_resampler.cc |
| similarity index 88% |
| rename from webrtc/modules/audio_processing/aec/aec_resampler.c |
| rename to webrtc/modules/audio_processing/aec/aec_resampler.cc |
| index ae64ddf0f22decc0181ed650a80941e418cc10f3..00e3df5cf3ccfb7c14289d7a5f2d55d100b32774 100644 |
| --- a/webrtc/modules/audio_processing/aec/aec_resampler.c |
| +++ b/webrtc/modules/audio_processing/aec/aec_resampler.cc |
| @@ -43,7 +43,7 @@ void* WebRtcAec_CreateResampler() { |
| } |
| int WebRtcAec_InitResampler(void* resampInst, int deviceSampleRateHz) { |
| - AecResampler* obj = (AecResampler*)resampInst; |
| + AecResampler* obj = static_cast<AecResampler*>(resampInst); |
| memset(obj->buffer, 0, sizeof(obj->buffer)); |
| obj->position = 0.0; |
| @@ -56,7 +56,7 @@ int WebRtcAec_InitResampler(void* resampInst, int deviceSampleRateHz) { |
| } |
| void WebRtcAec_FreeResampler(void* resampInst) { |
| - AecResampler* obj = (AecResampler*)resampInst; |
| + AecResampler* obj = static_cast<AecResampler*>(resampInst); |
| free(obj); |
| } |
| @@ -66,7 +66,7 @@ void WebRtcAec_ResampleLinear(void* resampInst, |
| float skew, |
| float* outspeech, |
| size_t* size_out) { |
| - AecResampler* obj = (AecResampler*)resampInst; |
| + AecResampler* obj = static_cast<AecResampler*>(resampInst); |
| float* y; |
| float be, tnew; |
| @@ -98,7 +98,7 @@ void WebRtcAec_ResampleLinear(void* resampInst, |
| mm++; |
| tnew = be * mm + obj->position; |
| - tn = (int)tnew; |
| + tn = static_cast<int>(tnew); |
| } |
| *size_out = mm; |
| @@ -110,7 +110,7 @@ void WebRtcAec_ResampleLinear(void* resampInst, |
| } |
| int WebRtcAec_GetSkew(void* resampInst, int rawSkew, float* skewEst) { |
| - AecResampler* obj = (AecResampler*)resampInst; |
| + AecResampler* obj = reinterpret_cast<AecResampler*>(resampInst); |
|
the sun
2016/03/03 15:18:34
Why not static_cast here?
peah-webrtc
2016/03/03 19:14:53
Not sure why it is needed. The cl upload wanted th
the sun
2016/03/03 19:19:46
I think the CL should be consistent with itself. I
peah-webrtc
2016/03/04 05:14:19
Done.
|
| int err = 0; |
| if (obj->skewDataIndex < kEstimateLengthFrames) { |
| @@ -132,8 +132,8 @@ int EstimateSkew(const int* rawSkew, |
| int size, |
| int deviceSampleRateHz, |
| float* skewEst) { |
| - const int absLimitOuter = (int)(0.04f * deviceSampleRateHz); |
| - const int absLimitInner = (int)(0.0025f * deviceSampleRateHz); |
| + const int absLimitOuter = static_cast<int>(0.04f * deviceSampleRateHz); |
| + const int absLimitInner = static_cast<int>(0.0025f * deviceSampleRateHz); |
| int i = 0; |
| int n = 0; |
| float rawAvg = 0; |
| @@ -172,8 +172,8 @@ int EstimateSkew(const int* rawSkew, |
| } |
| assert(n > 0); |
| rawAbsDev /= n; |
| - upperLimit = (int)(rawAvg + 5 * rawAbsDev + 1); // +1 for ceiling. |
| - lowerLimit = (int)(rawAvg - 5 * rawAbsDev - 1); // -1 for floor. |
| + upperLimit = static_cast<int>(rawAvg + 5 * rawAbsDev + 1); // +1 for ceiling. |
| + lowerLimit = static_cast<int>(rawAvg - 5 * rawAbsDev - 1); // -1 for floor. |
| n = 0; |
| for (i = 0; i < size; i++) { |