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

Unified Diff: webrtc/modules/pacing/alr_detector.cc

Issue 3005003002: Make UBSan warnings fatal and fix the existing ones (Closed)
Patch Set: Fix UBSan warnings Created 3 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
Index: webrtc/modules/pacing/alr_detector.cc
diff --git a/webrtc/modules/pacing/alr_detector.cc b/webrtc/modules/pacing/alr_detector.cc
index 7d62b212511c56be3c0a779445fdeb1fa434bd8c..62b7f1a0a85c0d7e27e0024f79bfdd6161def01a 100644
--- a/webrtc/modules/pacing/alr_detector.cc
+++ b/webrtc/modules/pacing/alr_detector.cc
@@ -67,8 +67,9 @@ void AlrDetector::OnBytesSent(size_t bytes_sent, int64_t delta_time_ms) {
void AlrDetector::SetEstimatedBitrate(int bitrate_bps) {
RTC_DCHECK(bitrate_bps);
- alr_budget_.set_target_rate_kbps(bitrate_bps * bandwidth_usage_percent_ /
- (1000 * 100));
+ double target_rate_kbps = static_cast<double>(bitrate_bps) / 1000 *
+ bandwidth_usage_percent_ / 100;
+ alr_budget_.set_target_rate_kbps(rtc::dchecked_cast<int>(target_rate_kbps));
kwiberg-webrtc 2017/09/03 02:39:47 Why not use int64_t here instead of double? It'll
oprypin_webrtc 2017/09/04 08:36:07 Done.
}
rtc::Optional<int64_t> AlrDetector::GetApplicationLimitedRegionStartTime()

Powered by Google App Engine
This is Rietveld 408576698