OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 out = SetBit(out, i - kBandFirst); | 118 out = SetBit(out, i - kBandFirst); |
119 } | 119 } |
120 } | 120 } |
121 | 121 |
122 return out; | 122 return out; |
123 } | 123 } |
124 | 124 |
125 void WebRtc_FreeDelayEstimatorFarend(void* handle) { | 125 void WebRtc_FreeDelayEstimatorFarend(void* handle) { |
126 DelayEstimatorFarend* self = (DelayEstimatorFarend*) handle; | 126 DelayEstimatorFarend* self = (DelayEstimatorFarend*) handle; |
127 | 127 |
128 if (handle == NULL) { | 128 if (handle == nullptr) { |
129 return; | 129 return; |
130 } | 130 } |
131 | 131 |
132 free(self->mean_far_spectrum); | 132 free(self->mean_far_spectrum); |
133 self->mean_far_spectrum = NULL; | 133 self->mean_far_spectrum = nullptr; |
134 | 134 |
135 WebRtc_FreeBinaryDelayEstimatorFarend(self->binary_farend); | 135 WebRtc_FreeBinaryDelayEstimatorFarend(self->binary_farend); |
136 self->binary_farend = NULL; | 136 self->binary_farend = nullptr; |
137 | 137 |
138 free(self); | 138 free(self); |
139 } | 139 } |
140 | 140 |
141 void* WebRtc_CreateDelayEstimatorFarend(int spectrum_size, int history_size) { | 141 void* WebRtc_CreateDelayEstimatorFarend(int spectrum_size, int history_size) { |
142 DelayEstimatorFarend* self = NULL; | 142 DelayEstimatorFarend* self = nullptr; |
143 | 143 |
144 // Check if the sub band used in the delay estimation is small enough to fit | 144 // Check if the sub band used in the delay estimation is small enough to fit |
145 // the binary spectra in a uint32_t. | 145 // the binary spectra in a uint32_t. |
146 static_assert(kBandLast - kBandFirst < 32, ""); | 146 static_assert(kBandLast - kBandFirst < 32, ""); |
147 | 147 |
148 if (spectrum_size >= kBandLast) { | 148 if (spectrum_size >= kBandLast) { |
149 self = static_cast<DelayEstimatorFarend*>( | 149 self = static_cast<DelayEstimatorFarend*>( |
150 malloc(sizeof(DelayEstimatorFarend))); | 150 malloc(sizeof(DelayEstimatorFarend))); |
151 } | 151 } |
152 | 152 |
153 if (self != NULL) { | 153 if (self != nullptr) { |
154 int memory_fail = 0; | 154 int memory_fail = 0; |
155 | 155 |
156 // Allocate memory for the binary far-end spectrum handling. | 156 // Allocate memory for the binary far-end spectrum handling. |
157 self->binary_farend = WebRtc_CreateBinaryDelayEstimatorFarend(history_size); | 157 self->binary_farend = WebRtc_CreateBinaryDelayEstimatorFarend(history_size); |
158 memory_fail |= (self->binary_farend == NULL); | 158 memory_fail |= (self->binary_farend == nullptr); |
159 | 159 |
160 // Allocate memory for spectrum buffers. | 160 // Allocate memory for spectrum buffers. |
161 self->mean_far_spectrum = | 161 self->mean_far_spectrum = |
162 static_cast<SpectrumType*>(malloc(spectrum_size * sizeof(SpectrumType)))
; | 162 static_cast<SpectrumType*>(malloc(spectrum_size * sizeof(SpectrumType)))
; |
163 memory_fail |= (self->mean_far_spectrum == NULL); | 163 memory_fail |= (self->mean_far_spectrum == nullptr); |
164 | 164 |
165 self->spectrum_size = spectrum_size; | 165 self->spectrum_size = spectrum_size; |
166 | 166 |
167 if (memory_fail) { | 167 if (memory_fail) { |
168 WebRtc_FreeDelayEstimatorFarend(self); | 168 WebRtc_FreeDelayEstimatorFarend(self); |
169 self = NULL; | 169 self = nullptr; |
170 } | 170 } |
171 } | 171 } |
172 | 172 |
173 return self; | 173 return self; |
174 } | 174 } |
175 | 175 |
176 int WebRtc_InitDelayEstimatorFarend(void* handle) { | 176 int WebRtc_InitDelayEstimatorFarend(void* handle) { |
177 DelayEstimatorFarend* self = (DelayEstimatorFarend*) handle; | 177 DelayEstimatorFarend* self = (DelayEstimatorFarend*) handle; |
178 | 178 |
179 if (self == NULL) { | 179 if (self == nullptr) { |
180 return -1; | 180 return -1; |
181 } | 181 } |
182 | 182 |
183 // Initialize far-end part of binary delay estimator. | 183 // Initialize far-end part of binary delay estimator. |
184 WebRtc_InitBinaryDelayEstimatorFarend(self->binary_farend); | 184 WebRtc_InitBinaryDelayEstimatorFarend(self->binary_farend); |
185 | 185 |
186 // Set averaged far and near end spectra to zero. | 186 // Set averaged far and near end spectra to zero. |
187 memset(self->mean_far_spectrum, 0, | 187 memset(self->mean_far_spectrum, 0, |
188 sizeof(SpectrumType) * self->spectrum_size); | 188 sizeof(SpectrumType) * self->spectrum_size); |
189 // Reset initialization indicators. | 189 // Reset initialization indicators. |
190 self->far_spectrum_initialized = 0; | 190 self->far_spectrum_initialized = 0; |
191 | 191 |
192 return 0; | 192 return 0; |
193 } | 193 } |
194 | 194 |
195 void WebRtc_SoftResetDelayEstimatorFarend(void* handle, int delay_shift) { | 195 void WebRtc_SoftResetDelayEstimatorFarend(void* handle, int delay_shift) { |
196 DelayEstimatorFarend* self = (DelayEstimatorFarend*) handle; | 196 DelayEstimatorFarend* self = (DelayEstimatorFarend*) handle; |
197 RTC_DCHECK(self); | 197 RTC_DCHECK(self); |
198 WebRtc_SoftResetBinaryDelayEstimatorFarend(self->binary_farend, delay_shift); | 198 WebRtc_SoftResetBinaryDelayEstimatorFarend(self->binary_farend, delay_shift); |
199 } | 199 } |
200 | 200 |
201 int WebRtc_AddFarSpectrumFix(void* handle, | 201 int WebRtc_AddFarSpectrumFix(void* handle, |
202 const uint16_t* far_spectrum, | 202 const uint16_t* far_spectrum, |
203 int spectrum_size, | 203 int spectrum_size, |
204 int far_q) { | 204 int far_q) { |
205 DelayEstimatorFarend* self = (DelayEstimatorFarend*) handle; | 205 DelayEstimatorFarend* self = (DelayEstimatorFarend*) handle; |
206 uint32_t binary_spectrum = 0; | 206 uint32_t binary_spectrum = 0; |
207 | 207 |
208 if (self == NULL) { | 208 if (self == nullptr) { |
209 return -1; | 209 return -1; |
210 } | 210 } |
211 if (far_spectrum == NULL) { | 211 if (far_spectrum == nullptr) { |
212 // Empty far end spectrum. | 212 // Empty far end spectrum. |
213 return -1; | 213 return -1; |
214 } | 214 } |
215 if (spectrum_size != self->spectrum_size) { | 215 if (spectrum_size != self->spectrum_size) { |
216 // Data sizes don't match. | 216 // Data sizes don't match. |
217 return -1; | 217 return -1; |
218 } | 218 } |
219 if (far_q > 15) { | 219 if (far_q > 15) { |
220 // If |far_q| is larger than 15 we cannot guarantee no wrap around. | 220 // If |far_q| is larger than 15 we cannot guarantee no wrap around. |
221 return -1; | 221 return -1; |
222 } | 222 } |
223 | 223 |
224 // Get binary spectrum. | 224 // Get binary spectrum. |
225 binary_spectrum = BinarySpectrumFix(far_spectrum, self->mean_far_spectrum, | 225 binary_spectrum = BinarySpectrumFix(far_spectrum, self->mean_far_spectrum, |
226 far_q, &(self->far_spectrum_initialized)); | 226 far_q, &(self->far_spectrum_initialized)); |
227 WebRtc_AddBinaryFarSpectrum(self->binary_farend, binary_spectrum); | 227 WebRtc_AddBinaryFarSpectrum(self->binary_farend, binary_spectrum); |
228 | 228 |
229 return 0; | 229 return 0; |
230 } | 230 } |
231 | 231 |
232 int WebRtc_AddFarSpectrumFloat(void* handle, | 232 int WebRtc_AddFarSpectrumFloat(void* handle, |
233 const float* far_spectrum, | 233 const float* far_spectrum, |
234 int spectrum_size) { | 234 int spectrum_size) { |
235 DelayEstimatorFarend* self = (DelayEstimatorFarend*) handle; | 235 DelayEstimatorFarend* self = (DelayEstimatorFarend*) handle; |
236 uint32_t binary_spectrum = 0; | 236 uint32_t binary_spectrum = 0; |
237 | 237 |
238 if (self == NULL) { | 238 if (self == nullptr) { |
239 return -1; | 239 return -1; |
240 } | 240 } |
241 if (far_spectrum == NULL) { | 241 if (far_spectrum == nullptr) { |
242 // Empty far end spectrum. | 242 // Empty far end spectrum. |
243 return -1; | 243 return -1; |
244 } | 244 } |
245 if (spectrum_size != self->spectrum_size) { | 245 if (spectrum_size != self->spectrum_size) { |
246 // Data sizes don't match. | 246 // Data sizes don't match. |
247 return -1; | 247 return -1; |
248 } | 248 } |
249 | 249 |
250 // Get binary spectrum. | 250 // Get binary spectrum. |
251 binary_spectrum = BinarySpectrumFloat(far_spectrum, self->mean_far_spectrum, | 251 binary_spectrum = BinarySpectrumFloat(far_spectrum, self->mean_far_spectrum, |
252 &(self->far_spectrum_initialized)); | 252 &(self->far_spectrum_initialized)); |
253 WebRtc_AddBinaryFarSpectrum(self->binary_farend, binary_spectrum); | 253 WebRtc_AddBinaryFarSpectrum(self->binary_farend, binary_spectrum); |
254 | 254 |
255 return 0; | 255 return 0; |
256 } | 256 } |
257 | 257 |
258 void WebRtc_FreeDelayEstimator(void* handle) { | 258 void WebRtc_FreeDelayEstimator(void* handle) { |
259 DelayEstimator* self = (DelayEstimator*) handle; | 259 DelayEstimator* self = (DelayEstimator*) handle; |
260 | 260 |
261 if (handle == NULL) { | 261 if (handle == nullptr) { |
262 return; | 262 return; |
263 } | 263 } |
264 | 264 |
265 free(self->mean_near_spectrum); | 265 free(self->mean_near_spectrum); |
266 self->mean_near_spectrum = NULL; | 266 self->mean_near_spectrum = nullptr; |
267 | 267 |
268 WebRtc_FreeBinaryDelayEstimator(self->binary_handle); | 268 WebRtc_FreeBinaryDelayEstimator(self->binary_handle); |
269 self->binary_handle = NULL; | 269 self->binary_handle = nullptr; |
270 | 270 |
271 free(self); | 271 free(self); |
272 } | 272 } |
273 | 273 |
274 void* WebRtc_CreateDelayEstimator(void* farend_handle, int max_lookahead) { | 274 void* WebRtc_CreateDelayEstimator(void* farend_handle, int max_lookahead) { |
275 DelayEstimator* self = NULL; | 275 DelayEstimator* self = nullptr; |
276 DelayEstimatorFarend* farend = (DelayEstimatorFarend*) farend_handle; | 276 DelayEstimatorFarend* farend = (DelayEstimatorFarend*) farend_handle; |
277 | 277 |
278 if (farend_handle != NULL) { | 278 if (farend_handle != nullptr) { |
279 self = static_cast<DelayEstimator*>(malloc(sizeof(DelayEstimator))); | 279 self = static_cast<DelayEstimator*>(malloc(sizeof(DelayEstimator))); |
280 } | 280 } |
281 | 281 |
282 if (self != NULL) { | 282 if (self != nullptr) { |
283 int memory_fail = 0; | 283 int memory_fail = 0; |
284 | 284 |
285 // Allocate memory for the farend spectrum handling. | 285 // Allocate memory for the farend spectrum handling. |
286 self->binary_handle = | 286 self->binary_handle = |
287 WebRtc_CreateBinaryDelayEstimator(farend->binary_farend, max_lookahead); | 287 WebRtc_CreateBinaryDelayEstimator(farend->binary_farend, max_lookahead); |
288 memory_fail |= (self->binary_handle == NULL); | 288 memory_fail |= (self->binary_handle == nullptr); |
289 | 289 |
290 // Allocate memory for spectrum buffers. | 290 // Allocate memory for spectrum buffers. |
291 self->mean_near_spectrum = static_cast<SpectrumType*>( | 291 self->mean_near_spectrum = static_cast<SpectrumType*>( |
292 malloc(farend->spectrum_size * sizeof(SpectrumType))); | 292 malloc(farend->spectrum_size * sizeof(SpectrumType))); |
293 memory_fail |= (self->mean_near_spectrum == NULL); | 293 memory_fail |= (self->mean_near_spectrum == nullptr); |
294 | 294 |
295 self->spectrum_size = farend->spectrum_size; | 295 self->spectrum_size = farend->spectrum_size; |
296 | 296 |
297 if (memory_fail) { | 297 if (memory_fail) { |
298 WebRtc_FreeDelayEstimator(self); | 298 WebRtc_FreeDelayEstimator(self); |
299 self = NULL; | 299 self = nullptr; |
300 } | 300 } |
301 } | 301 } |
302 | 302 |
303 return self; | 303 return self; |
304 } | 304 } |
305 | 305 |
306 int WebRtc_InitDelayEstimator(void* handle) { | 306 int WebRtc_InitDelayEstimator(void* handle) { |
307 DelayEstimator* self = (DelayEstimator*) handle; | 307 DelayEstimator* self = (DelayEstimator*) handle; |
308 | 308 |
309 if (self == NULL) { | 309 if (self == nullptr) { |
310 return -1; | 310 return -1; |
311 } | 311 } |
312 | 312 |
313 // Initialize binary delay estimator. | 313 // Initialize binary delay estimator. |
314 WebRtc_InitBinaryDelayEstimator(self->binary_handle); | 314 WebRtc_InitBinaryDelayEstimator(self->binary_handle); |
315 | 315 |
316 // Set averaged far and near end spectra to zero. | 316 // Set averaged far and near end spectra to zero. |
317 memset(self->mean_near_spectrum, 0, | 317 memset(self->mean_near_spectrum, 0, |
318 sizeof(SpectrumType) * self->spectrum_size); | 318 sizeof(SpectrumType) * self->spectrum_size); |
319 // Reset initialization indicators. | 319 // Reset initialization indicators. |
320 self->near_spectrum_initialized = 0; | 320 self->near_spectrum_initialized = 0; |
321 | 321 |
322 return 0; | 322 return 0; |
323 } | 323 } |
324 | 324 |
325 int WebRtc_SoftResetDelayEstimator(void* handle, int delay_shift) { | 325 int WebRtc_SoftResetDelayEstimator(void* handle, int delay_shift) { |
326 DelayEstimator* self = (DelayEstimator*) handle; | 326 DelayEstimator* self = (DelayEstimator*) handle; |
327 RTC_DCHECK(self); | 327 RTC_DCHECK(self); |
328 return WebRtc_SoftResetBinaryDelayEstimator(self->binary_handle, delay_shift); | 328 return WebRtc_SoftResetBinaryDelayEstimator(self->binary_handle, delay_shift); |
329 } | 329 } |
330 | 330 |
331 int WebRtc_set_history_size(void* handle, int history_size) { | 331 int WebRtc_set_history_size(void* handle, int history_size) { |
332 DelayEstimator* self = static_cast<DelayEstimator*>(handle); | 332 DelayEstimator* self = static_cast<DelayEstimator*>(handle); |
333 | 333 |
334 if ((self == NULL) || (history_size <= 1)) { | 334 if ((self == nullptr) || (history_size <= 1)) { |
335 return -1; | 335 return -1; |
336 } | 336 } |
337 return WebRtc_AllocateHistoryBufferMemory(self->binary_handle, history_size); | 337 return WebRtc_AllocateHistoryBufferMemory(self->binary_handle, history_size); |
338 } | 338 } |
339 | 339 |
340 int WebRtc_history_size(const void* handle) { | 340 int WebRtc_history_size(const void* handle) { |
341 const DelayEstimator* self = static_cast<const DelayEstimator*>(handle); | 341 const DelayEstimator* self = static_cast<const DelayEstimator*>(handle); |
342 | 342 |
343 if (self == NULL) { | 343 if (self == nullptr) { |
344 return -1; | 344 return -1; |
345 } | 345 } |
346 if (self->binary_handle->farend->history_size != | 346 if (self->binary_handle->farend->history_size != |
347 self->binary_handle->history_size) { | 347 self->binary_handle->history_size) { |
348 // Non matching history sizes. | 348 // Non matching history sizes. |
349 return -1; | 349 return -1; |
350 } | 350 } |
351 return self->binary_handle->history_size; | 351 return self->binary_handle->history_size; |
352 } | 352 } |
353 | 353 |
(...skipping 12 matching lines...) Expand all Loading... |
366 int WebRtc_lookahead(void* handle) { | 366 int WebRtc_lookahead(void* handle) { |
367 DelayEstimator* self = (DelayEstimator*) handle; | 367 DelayEstimator* self = (DelayEstimator*) handle; |
368 RTC_DCHECK(self); | 368 RTC_DCHECK(self); |
369 RTC_DCHECK(self->binary_handle); | 369 RTC_DCHECK(self->binary_handle); |
370 return self->binary_handle->lookahead; | 370 return self->binary_handle->lookahead; |
371 } | 371 } |
372 | 372 |
373 int WebRtc_set_allowed_offset(void* handle, int allowed_offset) { | 373 int WebRtc_set_allowed_offset(void* handle, int allowed_offset) { |
374 DelayEstimator* self = (DelayEstimator*) handle; | 374 DelayEstimator* self = (DelayEstimator*) handle; |
375 | 375 |
376 if ((self == NULL) || (allowed_offset < 0)) { | 376 if ((self == nullptr) || (allowed_offset < 0)) { |
377 return -1; | 377 return -1; |
378 } | 378 } |
379 self->binary_handle->allowed_offset = allowed_offset; | 379 self->binary_handle->allowed_offset = allowed_offset; |
380 return 0; | 380 return 0; |
381 } | 381 } |
382 | 382 |
383 int WebRtc_get_allowed_offset(const void* handle) { | 383 int WebRtc_get_allowed_offset(const void* handle) { |
384 const DelayEstimator* self = (const DelayEstimator*) handle; | 384 const DelayEstimator* self = (const DelayEstimator*) handle; |
385 | 385 |
386 if (self == NULL) { | 386 if (self == nullptr) { |
387 return -1; | 387 return -1; |
388 } | 388 } |
389 return self->binary_handle->allowed_offset; | 389 return self->binary_handle->allowed_offset; |
390 } | 390 } |
391 | 391 |
392 int WebRtc_enable_robust_validation(void* handle, int enable) { | 392 int WebRtc_enable_robust_validation(void* handle, int enable) { |
393 DelayEstimator* self = (DelayEstimator*) handle; | 393 DelayEstimator* self = (DelayEstimator*) handle; |
394 | 394 |
395 if (self == NULL) { | 395 if (self == nullptr) { |
396 return -1; | 396 return -1; |
397 } | 397 } |
398 if ((enable < 0) || (enable > 1)) { | 398 if ((enable < 0) || (enable > 1)) { |
399 return -1; | 399 return -1; |
400 } | 400 } |
401 RTC_DCHECK(self->binary_handle); | 401 RTC_DCHECK(self->binary_handle); |
402 self->binary_handle->robust_validation_enabled = enable; | 402 self->binary_handle->robust_validation_enabled = enable; |
403 return 0; | 403 return 0; |
404 } | 404 } |
405 | 405 |
406 int WebRtc_is_robust_validation_enabled(const void* handle) { | 406 int WebRtc_is_robust_validation_enabled(const void* handle) { |
407 const DelayEstimator* self = (const DelayEstimator*) handle; | 407 const DelayEstimator* self = (const DelayEstimator*) handle; |
408 | 408 |
409 if (self == NULL) { | 409 if (self == nullptr) { |
410 return -1; | 410 return -1; |
411 } | 411 } |
412 return self->binary_handle->robust_validation_enabled; | 412 return self->binary_handle->robust_validation_enabled; |
413 } | 413 } |
414 | 414 |
415 int WebRtc_DelayEstimatorProcessFix(void* handle, | 415 int WebRtc_DelayEstimatorProcessFix(void* handle, |
416 const uint16_t* near_spectrum, | 416 const uint16_t* near_spectrum, |
417 int spectrum_size, | 417 int spectrum_size, |
418 int near_q) { | 418 int near_q) { |
419 DelayEstimator* self = (DelayEstimator*) handle; | 419 DelayEstimator* self = (DelayEstimator*) handle; |
420 uint32_t binary_spectrum = 0; | 420 uint32_t binary_spectrum = 0; |
421 | 421 |
422 if (self == NULL) { | 422 if (self == nullptr) { |
423 return -1; | 423 return -1; |
424 } | 424 } |
425 if (near_spectrum == NULL) { | 425 if (near_spectrum == nullptr) { |
426 // Empty near end spectrum. | 426 // Empty near end spectrum. |
427 return -1; | 427 return -1; |
428 } | 428 } |
429 if (spectrum_size != self->spectrum_size) { | 429 if (spectrum_size != self->spectrum_size) { |
430 // Data sizes don't match. | 430 // Data sizes don't match. |
431 return -1; | 431 return -1; |
432 } | 432 } |
433 if (near_q > 15) { | 433 if (near_q > 15) { |
434 // If |near_q| is larger than 15 we cannot guarantee no wrap around. | 434 // If |near_q| is larger than 15 we cannot guarantee no wrap around. |
435 return -1; | 435 return -1; |
436 } | 436 } |
437 | 437 |
438 // Get binary spectra. | 438 // Get binary spectra. |
439 binary_spectrum = BinarySpectrumFix(near_spectrum, | 439 binary_spectrum = BinarySpectrumFix(near_spectrum, |
440 self->mean_near_spectrum, | 440 self->mean_near_spectrum, |
441 near_q, | 441 near_q, |
442 &(self->near_spectrum_initialized)); | 442 &(self->near_spectrum_initialized)); |
443 | 443 |
444 return WebRtc_ProcessBinarySpectrum(self->binary_handle, binary_spectrum); | 444 return WebRtc_ProcessBinarySpectrum(self->binary_handle, binary_spectrum); |
445 } | 445 } |
446 | 446 |
447 int WebRtc_DelayEstimatorProcessFloat(void* handle, | 447 int WebRtc_DelayEstimatorProcessFloat(void* handle, |
448 const float* near_spectrum, | 448 const float* near_spectrum, |
449 int spectrum_size) { | 449 int spectrum_size) { |
450 DelayEstimator* self = (DelayEstimator*) handle; | 450 DelayEstimator* self = (DelayEstimator*) handle; |
451 uint32_t binary_spectrum = 0; | 451 uint32_t binary_spectrum = 0; |
452 | 452 |
453 if (self == NULL) { | 453 if (self == nullptr) { |
454 return -1; | 454 return -1; |
455 } | 455 } |
456 if (near_spectrum == NULL) { | 456 if (near_spectrum == nullptr) { |
457 // Empty near end spectrum. | 457 // Empty near end spectrum. |
458 return -1; | 458 return -1; |
459 } | 459 } |
460 if (spectrum_size != self->spectrum_size) { | 460 if (spectrum_size != self->spectrum_size) { |
461 // Data sizes don't match. | 461 // Data sizes don't match. |
462 return -1; | 462 return -1; |
463 } | 463 } |
464 | 464 |
465 // Get binary spectrum. | 465 // Get binary spectrum. |
466 binary_spectrum = BinarySpectrumFloat(near_spectrum, self->mean_near_spectrum, | 466 binary_spectrum = BinarySpectrumFloat(near_spectrum, self->mean_near_spectrum, |
467 &(self->near_spectrum_initialized)); | 467 &(self->near_spectrum_initialized)); |
468 | 468 |
469 return WebRtc_ProcessBinarySpectrum(self->binary_handle, binary_spectrum); | 469 return WebRtc_ProcessBinarySpectrum(self->binary_handle, binary_spectrum); |
470 } | 470 } |
471 | 471 |
472 int WebRtc_last_delay(void* handle) { | 472 int WebRtc_last_delay(void* handle) { |
473 DelayEstimator* self = (DelayEstimator*) handle; | 473 DelayEstimator* self = (DelayEstimator*) handle; |
474 | 474 |
475 if (self == NULL) { | 475 if (self == nullptr) { |
476 return -1; | 476 return -1; |
477 } | 477 } |
478 | 478 |
479 return WebRtc_binary_last_delay(self->binary_handle); | 479 return WebRtc_binary_last_delay(self->binary_handle); |
480 } | 480 } |
481 | 481 |
482 float WebRtc_last_delay_quality(void* handle) { | 482 float WebRtc_last_delay_quality(void* handle) { |
483 DelayEstimator* self = (DelayEstimator*) handle; | 483 DelayEstimator* self = (DelayEstimator*) handle; |
484 RTC_DCHECK(self); | 484 RTC_DCHECK(self); |
485 return WebRtc_binary_last_delay_quality(self->binary_handle); | 485 return WebRtc_binary_last_delay_quality(self->binary_handle); |
486 } | 486 } |
OLD | NEW |