Cleanup: Using DCHECK comparison macros for unit types.

This provides nicer error messages.

Bug: webrtc:9883
Change-Id: I7664c12f34bec2ba46a4057b1f45958daf3944b8
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/132707
Reviewed-by: Åsa Persson <asapersson@webrtc.org>
Commit-Queue: Sebastian Jansson <srte@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#27590}
This commit is contained in:
Sebastian Jansson
2019-04-12 11:21:32 +02:00
committed by Commit Bot
parent e8cbf30231
commit 5a000165d2
6 changed files with 7 additions and 7 deletions

View File

@ -280,7 +280,7 @@ void SendSideBandwidthEstimation::SetBitrates(
void SendSideBandwidthEstimation::SetSendBitrate(DataRate bitrate,
Timestamp at_time) {
RTC_DCHECK(bitrate > DataRate::Zero());
RTC_DCHECK_GT(bitrate, DataRate::Zero());
// Reset to avoid being capped by the estimate.
delay_based_bitrate_ = DataRate::Zero();
if (loss_based_bandwidth_estimation_.Enabled()) {

View File

@ -265,7 +265,7 @@ class SimulatedClockWithFrames : public SimulatedClock {
bool frame_injected = false;
while (!timestamps_.empty() &&
timestamps_.front().arrive_time <= end_time) {
RTC_DCHECK(timestamps_.front().arrive_time >= start_time);
RTC_DCHECK_GE(timestamps_.front().arrive_time, start_time);
SimulatedClock::AdvanceTimeMicroseconds(timestamps_.front().arrive_time -
TimeInMicroseconds());
@ -293,7 +293,7 @@ class SimulatedClockWithFrames : public SimulatedClock {
size_t size) {
int64_t previous_arrive_timestamp = 0;
for (size_t i = 0; i < size; i++) {
RTC_CHECK(arrive_timestamps[i] >= previous_arrive_timestamp);
RTC_CHECK_GE(arrive_timestamps[i], previous_arrive_timestamp);
timestamps_.push(TimestampPair(arrive_timestamps[i] * 1000,
render_timestamps[i] * 1000));
previous_arrive_timestamp = arrive_timestamps[i];

View File

@ -312,7 +312,7 @@ void Scenario::Every(TimeDelta interval, std::function<void()> function) {
}
void Scenario::At(TimeDelta offset, std::function<void()> function) {
RTC_DCHECK_GT(offset.ms(), TimeSinceStart().ms());
RTC_DCHECK_GT(offset, TimeSinceStart());
task_queue_.PostDelayedTask(function, TimeUntilTarget(offset).ms());
}

View File

@ -258,7 +258,7 @@ std::unique_ptr<FrameGenerator> CreateImageSlideGenerator(
if (slides.images.crop.width || slides.images.crop.height) {
TimeDelta pause_duration =
slides.change_interval - slides.images.crop.scroll_duration;
RTC_CHECK(pause_duration >= TimeDelta::Zero());
RTC_CHECK_GE(pause_duration, TimeDelta::Zero());
int crop_width = slides.images.crop.width.value_or(slides.images.width);
int crop_height = slides.images.crop.height.value_or(slides.images.height);
RTC_CHECK_LE(crop_width, slides.images.width);

View File

@ -382,7 +382,7 @@ Timestamp SimulatedTimeControllerImpl::NextRunTime() const {
void SimulatedTimeControllerImpl::AdvanceTime(Timestamp target_time) {
rtc::CritScope time_lock(&time_lock_);
RTC_DCHECK(target_time >= current_time_);
RTC_DCHECK_GE(target_time, current_time_);
current_time_ = target_time;
}

View File

@ -1516,7 +1516,7 @@ void VideoStreamEncoder::OnBitrateUpdated(DataRate target_bitrate,
DataRate link_allocation,
uint8_t fraction_lost,
int64_t round_trip_time_ms) {
RTC_DCHECK(link_allocation >= target_bitrate);
RTC_DCHECK_GE(link_allocation, target_bitrate);
if (!encoder_queue_.IsCurrent()) {
encoder_queue_.PostTask([this, target_bitrate, link_allocation,
fraction_lost, round_trip_time_ms] {