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

Unified Diff: webrtc/modules/audio_processing/transient/transient_detector.cc

Issue 2320053003: webrtc/modules/audio_processing: Use RTC_DCHECK() instead of assert() (Closed)
Patch Set: rebase Created 4 years, 3 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
« no previous file with comments | « webrtc/modules/audio_processing/rms_level.cc ('k') | webrtc/modules/audio_processing/transient/wpd_node.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/modules/audio_processing/transient/transient_detector.cc
diff --git a/webrtc/modules/audio_processing/transient/transient_detector.cc b/webrtc/modules/audio_processing/transient/transient_detector.cc
index 12a50bd46be85c9c512047c9e5b7109a43ac90ad..987ff8130bba0c49b464aeee5bd7222c9052a0c4 100644
--- a/webrtc/modules/audio_processing/transient/transient_detector.cc
+++ b/webrtc/modules/audio_processing/transient/transient_detector.cc
@@ -10,13 +10,13 @@
#include "webrtc/modules/audio_processing/transient/transient_detector.h"
-#include <assert.h>
#include <float.h>
#include <math.h>
#include <string.h>
#include <algorithm>
+#include "webrtc/base/checks.h"
#include "webrtc/modules/audio_processing/transient/common.h"
#include "webrtc/modules/audio_processing/transient/daubechies_8_wavelet_coeffs.h"
#include "webrtc/modules/audio_processing/transient/moving_moments.h"
@@ -36,10 +36,10 @@ TransientDetector::TransientDetector(int sample_rate_hz)
chunks_at_startup_left_to_delete_(kChunksAtStartupLeftToDelete),
reference_energy_(1.f),
using_reference_(false) {
- assert(sample_rate_hz == ts::kSampleRate8kHz ||
- sample_rate_hz == ts::kSampleRate16kHz ||
- sample_rate_hz == ts::kSampleRate32kHz ||
- sample_rate_hz == ts::kSampleRate48kHz);
+ RTC_DCHECK(sample_rate_hz == ts::kSampleRate8kHz ||
+ sample_rate_hz == ts::kSampleRate16kHz ||
+ sample_rate_hz == ts::kSampleRate32kHz ||
+ sample_rate_hz == ts::kSampleRate48kHz);
int samples_per_transient = sample_rate_hz * kTransientLengthMs / 1000;
// Adjustment to avoid data loss while downsampling, making
// |samples_per_chunk_| and |samples_per_transient| always divisible by
@@ -72,7 +72,8 @@ float TransientDetector::Detect(const float* data,
size_t data_length,
const float* reference_data,
size_t reference_length) {
- assert(data && data_length == samples_per_chunk_);
+ RTC_DCHECK(data);
+ RTC_DCHECK_EQ(samples_per_chunk_, data_length);
// TODO(aluebs): Check if these errors can logically happen and if not assert
// on them.
@@ -160,7 +161,7 @@ float TransientDetector::ReferenceDetectionValue(const float* data,
using_reference_ = false;
return 1.f;
}
- assert(reference_energy_ != 0);
+ RTC_DCHECK_NE(0, reference_energy_);
float result = 1.f / (1.f + exp(kReferenceNonLinearity *
(kEnergyRatioThreshold -
reference_energy / reference_energy_)));
« no previous file with comments | « webrtc/modules/audio_processing/rms_level.cc ('k') | webrtc/modules/audio_processing/transient/wpd_node.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698