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

Unified Diff: webrtc/modules/audio_processing/utility/delay_estimator.cc

Issue 1878613002: Changed the delay estimator to be built using C++ (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Rebase with latest master Created 4 years, 8 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/utility/delay_estimator.cc
diff --git a/webrtc/modules/audio_processing/utility/delay_estimator.c b/webrtc/modules/audio_processing/utility/delay_estimator.cc
similarity index 97%
rename from webrtc/modules/audio_processing/utility/delay_estimator.c
rename to webrtc/modules/audio_processing/utility/delay_estimator.cc
index f9f3dc24571a7657913534ce8225bdaf486d417b..15a67472b176a0cd549c73db302bdc9b73eb3162 100644
--- a/webrtc/modules/audio_processing/utility/delay_estimator.c
+++ b/webrtc/modules/audio_processing/utility/delay_estimator.cc
@@ -276,7 +276,8 @@ BinaryDelayEstimatorFarend* WebRtc_CreateBinaryDelayEstimatorFarend(
if (history_size > 1) {
// Sanity conditions fulfilled.
- self = malloc(sizeof(BinaryDelayEstimatorFarend));
+ self = static_cast<BinaryDelayEstimatorFarend*>(
+ malloc(sizeof(BinaryDelayEstimatorFarend)));
}
if (self == NULL) {
return NULL;
@@ -296,11 +297,12 @@ int WebRtc_AllocateFarendBufferMemory(BinaryDelayEstimatorFarend* self,
int history_size) {
assert(self != NULL);
// (Re-)Allocate memory for history buffers.
- self->binary_far_history =
+ self->binary_far_history = static_cast<uint32_t*>(
realloc(self->binary_far_history,
- history_size * sizeof(*self->binary_far_history));
- self->far_bit_counts = realloc(self->far_bit_counts,
- history_size * sizeof(*self->far_bit_counts));
+ history_size * sizeof(*self->binary_far_history)));
+ self->far_bit_counts = static_cast<int*>(
+ realloc(self->far_bit_counts,
+ history_size * sizeof(*self->far_bit_counts)));
if ((self->binary_far_history == NULL) || (self->far_bit_counts == NULL)) {
history_size = 0;
}
@@ -404,7 +406,8 @@ BinaryDelayEstimator* WebRtc_CreateBinaryDelayEstimator(
if ((farend != NULL) && (max_lookahead >= 0)) {
// Sanity conditions fulfilled.
- self = malloc(sizeof(BinaryDelayEstimator));
+ self = static_cast<BinaryDelayEstimator*>(
+ malloc(sizeof(BinaryDelayEstimator)));
}
if (self == NULL) {
return NULL;
@@ -422,8 +425,8 @@ BinaryDelayEstimator* WebRtc_CreateBinaryDelayEstimator(
self->mean_bit_counts = NULL;
self->bit_counts = NULL;
self->histogram = NULL;
- self->binary_near_history =
- malloc((max_lookahead + 1) * sizeof(*self->binary_near_history));
+ self->binary_near_history = static_cast<uint32_t*>(
+ malloc((max_lookahead + 1) * sizeof(*self->binary_near_history)));
if (self->binary_near_history == NULL ||
WebRtc_AllocateHistoryBufferMemory(self, farend->history_size) == 0) {
WebRtc_FreeBinaryDelayEstimator(self);
@@ -444,13 +447,13 @@ int WebRtc_AllocateHistoryBufferMemory(BinaryDelayEstimator* self,
// The extra array element in |mean_bit_counts| and |histogram| is a dummy
// element only used while |last_delay| == -2, i.e., before we have a valid
// estimate.
- self->mean_bit_counts =
+ self->mean_bit_counts = static_cast<int32_t*>(
realloc(self->mean_bit_counts,
- (history_size + 1) * sizeof(*self->mean_bit_counts));
- self->bit_counts =
- realloc(self->bit_counts, history_size * sizeof(*self->bit_counts));
- self->histogram =
- realloc(self->histogram, (history_size + 1) * sizeof(*self->histogram));
+ (history_size + 1) * sizeof(*self->mean_bit_counts)));
+ self->bit_counts = static_cast<int32_t*>(
+ realloc(self->bit_counts, history_size * sizeof(*self->bit_counts)));
+ self->histogram = static_cast<float*>(
+ realloc(self->histogram, (history_size + 1) * sizeof(*self->histogram)));
if ((self->mean_bit_counts == NULL) ||
(self->bit_counts == NULL) ||

Powered by Google App Engine
This is Rietveld 408576698