Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(279)

Unified Diff: webrtc/modules/audio_processing/aec/aec_resampler.cc

Issue 1754223004: Move aec_resampler.c to be built using C++ (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Corrected casts Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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++) {
« no previous file with comments | « webrtc/modules/audio_processing/aec/aec_resampler.c ('k') | webrtc/modules/audio_processing/aec/echo_cancellation.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698