diff options
author | henrikg <henrikg@webrtc.org> | 2015-09-17 00:24:34 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-09-17 07:24:51 +0000 |
commit | 91d6edef35e7275879c30ce16ecb8b6dc73c6e4a (patch) | |
tree | 313b64a3d88422a53f5b091f770a2d33dce823ce /webrtc/modules/audio_processing/test | |
parent | c0ac6cad00f51b99fafaa7c19e2e63b3b542735b (diff) | |
download | webrtc-91d6edef35e7275879c30ce16ecb8b6dc73c6e4a.tar.gz |
Add RTC_ prefix to (D)CHECKs and related macros.
We must remove dependency on Chromium, i.e. we can't use Chromium's base/logging.h. That means we need to define these macros in WebRTC also when doing Chromium builds. And this causes redefinition.
Alternative solutions:
* Check if we already have defined e.g. CHECK, and don't define them in that case. This makes us depend on include order in Chromium, which is not acceptable.
* Don't allow using the macros in WebRTC headers. Error prone since if someone adds it there by mistake it may compile fine, but later break if a header in added or order is changed in Chromium. That will be confusing and hard to enforce.
* Ensure that headers that are included by an embedder don't include our macros. This would require some heavy refactoring to be maintainable and enforcable.
* Changes in Chromium for this is obviously not an option.
BUG=chromium:468375
NOTRY=true
Review URL: https://codereview.webrtc.org/1335923002
Cr-Commit-Position: refs/heads/master@{#9964}
Diffstat (limited to 'webrtc/modules/audio_processing/test')
-rw-r--r-- | webrtc/modules/audio_processing/test/audioproc_float.cc | 29 | ||||
-rw-r--r-- | webrtc/modules/audio_processing/test/test_utils.cc | 4 |
2 files changed, 18 insertions, 15 deletions
diff --git a/webrtc/modules/audio_processing/test/audioproc_float.cc b/webrtc/modules/audio_processing/test/audioproc_float.cc index f4aab32acf..9c44d76ecc 100644 --- a/webrtc/modules/audio_processing/test/audioproc_float.cc +++ b/webrtc/modules/audio_processing/test/audioproc_float.cc @@ -105,26 +105,29 @@ int main(int argc, char* argv[]) { const size_t num_mics = in_file.num_channels(); const std::vector<Point> array_geometry = ParseArrayGeometry(FLAGS_mic_positions, num_mics); - CHECK_EQ(array_geometry.size(), num_mics); + RTC_CHECK_EQ(array_geometry.size(), num_mics); config.Set<Beamforming>(new Beamforming(true, array_geometry)); } rtc::scoped_ptr<AudioProcessing> ap(AudioProcessing::Create(config)); if (!FLAGS_dump.empty()) { - CHECK_EQ(kNoErr, ap->echo_cancellation()->Enable(FLAGS_aec || FLAGS_all)); + RTC_CHECK_EQ(kNoErr, + ap->echo_cancellation()->Enable(FLAGS_aec || FLAGS_all)); } else if (FLAGS_aec) { fprintf(stderr, "-aec requires a -dump file.\n"); return -1; } bool process_reverse = !FLAGS_i_rev.empty(); - CHECK_EQ(kNoErr, ap->gain_control()->Enable(FLAGS_agc || FLAGS_all)); - CHECK_EQ(kNoErr, ap->gain_control()->set_mode(GainControl::kFixedDigital)); - CHECK_EQ(kNoErr, ap->high_pass_filter()->Enable(FLAGS_hpf || FLAGS_all)); - CHECK_EQ(kNoErr, ap->noise_suppression()->Enable(FLAGS_ns || FLAGS_all)); + RTC_CHECK_EQ(kNoErr, ap->gain_control()->Enable(FLAGS_agc || FLAGS_all)); + RTC_CHECK_EQ(kNoErr, + ap->gain_control()->set_mode(GainControl::kFixedDigital)); + RTC_CHECK_EQ(kNoErr, ap->high_pass_filter()->Enable(FLAGS_hpf || FLAGS_all)); + RTC_CHECK_EQ(kNoErr, ap->noise_suppression()->Enable(FLAGS_ns || FLAGS_all)); if (FLAGS_ns_level != -1) - CHECK_EQ(kNoErr, ap->noise_suppression()->set_level( - static_cast<NoiseSuppression::Level>(FLAGS_ns_level))); + RTC_CHECK_EQ(kNoErr, + ap->noise_suppression()->set_level( + static_cast<NoiseSuppression::Level>(FLAGS_ns_level))); printf("Input file: %s\nChannels: %d, Sample rate: %d Hz\n\n", FLAGS_i.c_str(), in_file.num_channels(), in_file.sample_rate()); @@ -196,12 +199,12 @@ int main(int argc, char* argv[]) { if (FLAGS_perf) { processing_start_time = TickTime::Now(); } - CHECK_EQ(kNoErr, ap->ProcessStream(in_buf.channels(), input_config, - output_config, out_buf.channels())); + RTC_CHECK_EQ(kNoErr, ap->ProcessStream(in_buf.channels(), input_config, + output_config, out_buf.channels())); if (process_reverse) { - CHECK_EQ(kNoErr, ap->ProcessReverseStream( - in_rev_buf->channels(), reverse_input_config, - reverse_output_config, out_rev_buf->channels())); + RTC_CHECK_EQ(kNoErr, ap->ProcessReverseStream( + in_rev_buf->channels(), reverse_input_config, + reverse_output_config, out_rev_buf->channels())); } if (FLAGS_perf) { accumulated_time += TickTime::Now() - processing_start_time; diff --git a/webrtc/modules/audio_processing/test/test_utils.cc b/webrtc/modules/audio_processing/test/test_utils.cc index fe33ec0351..1b9ac3ce4c 100644 --- a/webrtc/modules/audio_processing/test/test_utils.cc +++ b/webrtc/modules/audio_processing/test/test_utils.cc @@ -100,8 +100,8 @@ AudioProcessing::ChannelLayout LayoutFromChannels(int num_channels) { std::vector<Point> ParseArrayGeometry(const std::string& mic_positions, size_t num_mics) { const std::vector<float> values = ParseList<float>(mic_positions); - CHECK_EQ(values.size(), 3 * num_mics) << - "Could not parse mic_positions or incorrect number of points."; + RTC_CHECK_EQ(values.size(), 3 * num_mics) + << "Could not parse mic_positions or incorrect number of points."; std::vector<Point> result; result.reserve(num_mics); |