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

Unified Diff: webrtc/modules/audio_coding/neteq/timestamp_scaler.cc

Issue 1685103002: Fix two UBSan warnings in NetEq (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 10 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/audio_coding/neteq/timestamp_scaler.cc
diff --git a/webrtc/modules/audio_coding/neteq/timestamp_scaler.cc b/webrtc/modules/audio_coding/neteq/timestamp_scaler.cc
index c1abdc30f508e58615e1b7595515f5e914eb286e..b228e017b2a30ffbcd70364d9d48d97e2b8d29f6 100644
--- a/webrtc/modules/audio_coding/neteq/timestamp_scaler.cc
+++ b/webrtc/modules/audio_coding/neteq/timestamp_scaler.cc
@@ -75,7 +75,7 @@ uint32_t TimestampScaler::ToInternal(uint32_t external_timestamp,
internal_ref_ = external_timestamp;
first_packet_received_ = true;
}
- int32_t external_diff = external_timestamp - external_ref_;
+ int64_t external_diff = external_timestamp - external_ref_;
assert(denominator_ > 0); // Should not be possible.
external_ref_ = external_timestamp;
internal_ref_ += (external_diff * numerator_) / denominator_;
@@ -92,7 +92,7 @@ uint32_t TimestampScaler::ToExternal(uint32_t internal_timestamp) const {
// Not initialized, or scale factor is 1.
return internal_timestamp;
} else {
- int32_t internal_diff = internal_timestamp - internal_ref_;
+ int64_t internal_diff = internal_timestamp - internal_ref_;
assert(numerator_ > 0); // Should not be possible.
// Do not update references in this method.
// Switch |denominator_| and |numerator_| to convert the other way.

Powered by Google App Engine
This is Rietveld 408576698