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/video/video_send_stream.cc b/webrtc/video/video_send_stream.cc
index 42ad774..2ab4eaa 100644
--- a/webrtc/video/video_send_stream.cc
+++ b/webrtc/video/video_send_stream.cc
@@ -117,9 +117,9 @@
channel_id_(channel_id),
use_config_bitrate_(true),
stats_proxy_(Clock::GetRealTimeClock(), config) {
- DCHECK(!config_.rtp.ssrcs.empty());
- CHECK(channel_group->CreateSendChannel(channel_id_, 0, &transport_adapter_,
- num_cpu_cores, config_.rtp.ssrcs));
+ RTC_DCHECK(!config_.rtp.ssrcs.empty());
+ RTC_CHECK(channel_group->CreateSendChannel(
+ channel_id_, 0, &transport_adapter_, num_cpu_cores, config_.rtp.ssrcs));
vie_channel_ = channel_group_->GetChannel(channel_id_);
vie_encoder_ = channel_group_->GetEncoder(channel_id_);
@@ -127,16 +127,16 @@
const std::string& extension = config_.rtp.extensions[i].name;
int id = config_.rtp.extensions[i].id;
// One-byte-extension local identifiers are in the range 1-14 inclusive.
- DCHECK_GE(id, 1);
- DCHECK_LE(id, 14);
+ RTC_DCHECK_GE(id, 1);
+ RTC_DCHECK_LE(id, 14);
if (extension == RtpExtension::kTOffset) {
- CHECK_EQ(0, vie_channel_->SetSendTimestampOffsetStatus(true, id));
+ RTC_CHECK_EQ(0, vie_channel_->SetSendTimestampOffsetStatus(true, id));
} else if (extension == RtpExtension::kAbsSendTime) {
- CHECK_EQ(0, vie_channel_->SetSendAbsoluteSendTimeStatus(true, id));
+ RTC_CHECK_EQ(0, vie_channel_->SetSendAbsoluteSendTimeStatus(true, id));
} else if (extension == RtpExtension::kVideoRotation) {
- CHECK_EQ(0, vie_channel_->SetSendVideoRotationStatus(true, id));
+ RTC_CHECK_EQ(0, vie_channel_->SetSendVideoRotationStatus(true, id));
} else if (extension == RtpExtension::kTransportSequenceNumber) {
- CHECK_EQ(0, vie_channel_->SetSendTransportSequenceNumber(true, id));
+ RTC_CHECK_EQ(0, vie_channel_->SetSendTransportSequenceNumber(true, id));
} else {
RTC_NOTREACHED() << "Registering unsupported RTP extension.";
}
@@ -164,18 +164,18 @@
&stats_proxy_, this));
// 28 to match packet overhead in ModuleRtpRtcpImpl.
- DCHECK_LE(config_.rtp.max_packet_size, static_cast<size_t>(0xFFFF - 28));
+ RTC_DCHECK_LE(config_.rtp.max_packet_size, static_cast<size_t>(0xFFFF - 28));
vie_channel_->SetMTU(static_cast<uint16_t>(config_.rtp.max_packet_size + 28));
- DCHECK(config.encoder_settings.encoder != nullptr);
- DCHECK_GE(config.encoder_settings.payload_type, 0);
- DCHECK_LE(config.encoder_settings.payload_type, 127);
- CHECK_EQ(0, vie_encoder_->RegisterExternalEncoder(
- config.encoder_settings.encoder,
- config.encoder_settings.payload_type,
- config.encoder_settings.internal_source));
+ RTC_DCHECK(config.encoder_settings.encoder != nullptr);
+ RTC_DCHECK_GE(config.encoder_settings.payload_type, 0);
+ RTC_DCHECK_LE(config.encoder_settings.payload_type, 127);
+ RTC_CHECK_EQ(0, vie_encoder_->RegisterExternalEncoder(
+ config.encoder_settings.encoder,
+ config.encoder_settings.payload_type,
+ config.encoder_settings.internal_source));
- CHECK(ReconfigureVideoEncoder(encoder_config));
+ RTC_CHECK(ReconfigureVideoEncoder(encoder_config));
vie_channel_->RegisterSendSideDelayObserver(&stats_proxy_);
vie_encoder_->RegisterSendStatisticsProxy(&stats_proxy_);
@@ -251,8 +251,8 @@
TRACE_EVENT0("webrtc", "VideoSendStream::(Re)configureVideoEncoder");
LOG(LS_INFO) << "(Re)configureVideoEncoder: " << config.ToString();
const std::vector<VideoStream>& streams = config.streams;
- DCHECK(!streams.empty());
- DCHECK_GE(config_.rtp.ssrcs.size(), streams.size());
+ RTC_DCHECK(!streams.empty());
+ RTC_DCHECK_GE(config_.rtp.ssrcs.size(), streams.size());
VideoCodec video_codec;
memset(&video_codec, 0, sizeof(video_codec));
@@ -311,7 +311,7 @@
}
} else {
// TODO(pbos): Support encoder_settings codec-agnostically.
- DCHECK(config.encoder_specific_settings == nullptr)
+ RTC_DCHECK(config.encoder_specific_settings == nullptr)
<< "Encoder-specific settings for codec type not wired up.";
}
@@ -323,18 +323,18 @@
video_codec.numberOfSimulcastStreams =
static_cast<unsigned char>(streams.size());
video_codec.minBitrate = streams[0].min_bitrate_bps / 1000;
- DCHECK_LE(streams.size(), static_cast<size_t>(kMaxSimulcastStreams));
+ RTC_DCHECK_LE(streams.size(), static_cast<size_t>(kMaxSimulcastStreams));
for (size_t i = 0; i < streams.size(); ++i) {
SimulcastStream* sim_stream = &video_codec.simulcastStream[i];
- DCHECK_GT(streams[i].width, 0u);
- DCHECK_GT(streams[i].height, 0u);
- DCHECK_GT(streams[i].max_framerate, 0);
+ RTC_DCHECK_GT(streams[i].width, 0u);
+ RTC_DCHECK_GT(streams[i].height, 0u);
+ RTC_DCHECK_GT(streams[i].max_framerate, 0);
// Different framerates not supported per stream at the moment.
- DCHECK_EQ(streams[i].max_framerate, streams[0].max_framerate);
- DCHECK_GE(streams[i].min_bitrate_bps, 0);
- DCHECK_GE(streams[i].target_bitrate_bps, streams[i].min_bitrate_bps);
- DCHECK_GE(streams[i].max_bitrate_bps, streams[i].target_bitrate_bps);
- DCHECK_GE(streams[i].max_qp, 0);
+ RTC_DCHECK_EQ(streams[i].max_framerate, streams[0].max_framerate);
+ RTC_DCHECK_GE(streams[i].min_bitrate_bps, 0);
+ RTC_DCHECK_GE(streams[i].target_bitrate_bps, streams[i].min_bitrate_bps);
+ RTC_DCHECK_GE(streams[i].max_bitrate_bps, streams[i].target_bitrate_bps);
+ RTC_DCHECK_GE(streams[i].max_qp, 0);
sim_stream->width = static_cast<unsigned short>(streams[i].width);
sim_stream->height = static_cast<unsigned short>(streams[i].height);
@@ -361,7 +361,7 @@
// the bitrate controller is already set from Call.
video_codec.startBitrate = 0;
- DCHECK_GT(streams[0].max_framerate, 0);
+ RTC_DCHECK_GT(streams[0].max_framerate, 0);
video_codec.maxFramerate = streams[0].max_framerate;
if (!SetSendCodec(video_codec))
@@ -373,7 +373,7 @@
stats_proxy_.OnInactiveSsrc(config_.rtp.ssrcs[i]);
}
- DCHECK_GE(config.min_transmit_bitrate_bps, 0);
+ RTC_DCHECK_GE(config.min_transmit_bitrate_bps, 0);
vie_encoder_->SetMinTransmitBitrate(config.min_transmit_bitrate_bps / 1000);
encoder_config_ = config;
@@ -415,7 +415,7 @@
}
// Set up RTX.
- DCHECK_EQ(config_.rtp.rtx.ssrcs.size(), config_.rtp.ssrcs.size());
+ RTC_DCHECK_EQ(config_.rtp.rtx.ssrcs.size(), config_.rtp.ssrcs.size());
for (size_t i = 0; i < config_.rtp.rtx.ssrcs.size(); ++i) {
uint32_t ssrc = config_.rtp.rtx.ssrcs[i];
vie_channel_->SetSSRC(config_.rtp.rtx.ssrcs[i], kViEStreamTypeRtx,
@@ -425,7 +425,7 @@
vie_channel_->SetRtpStateForSsrc(ssrc, it->second);
}
- DCHECK_GE(config_.rtp.rtx.payload_type, 0);
+ RTC_DCHECK_GE(config_.rtp.rtx.payload_type, 0);
vie_channel_->SetRtxSendPayloadType(config_.rtp.rtx.payload_type,
config_.encoder_settings.payload_type);
}