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}
diff --git a/webrtc/common_audio/audio_converter.cc b/webrtc/common_audio/audio_converter.cc
index 624c38d..07e5c6b 100644
--- a/webrtc/common_audio/audio_converter.cc
+++ b/webrtc/common_audio/audio_converter.cc
@@ -106,7 +106,7 @@
public:
CompositionConverter(ScopedVector<AudioConverter> converters)
: converters_(converters.Pass()) {
- CHECK_GE(converters_.size(), 2u);
+ RTC_CHECK_GE(converters_.size(), 2u);
// We need an intermediate buffer after every converter.
for (auto it = converters_.begin(); it != converters_.end() - 1; ++it)
buffers_.push_back(new ChannelBuffer<float>((*it)->dst_frames(),
@@ -188,12 +188,13 @@
src_frames_(src_frames),
dst_channels_(dst_channels),
dst_frames_(dst_frames) {
- CHECK(dst_channels == src_channels || dst_channels == 1 || src_channels == 1);
+ RTC_CHECK(dst_channels == src_channels || dst_channels == 1 ||
+ src_channels == 1);
}
void AudioConverter::CheckSizes(size_t src_size, size_t dst_capacity) const {
- CHECK_EQ(src_size, src_channels() * src_frames());
- CHECK_GE(dst_capacity, dst_channels() * dst_frames());
+ RTC_CHECK_EQ(src_size, src_channels() * src_frames());
+ RTC_CHECK_GE(dst_capacity, dst_channels() * dst_frames());
}
} // namespace webrtc