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

Unified Diff: webrtc/base/timeutils.cc

Issue 1779773002: Make rtc::TimestampWrapAroundHandler handle backwards wrapping (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 9 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
« no previous file with comments | « no previous file | webrtc/video/video_quality_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/base/timeutils.cc
diff --git a/webrtc/base/timeutils.cc b/webrtc/base/timeutils.cc
index 24b04ee2ee46342c1551901309042f8f4438955a..0d7273299efdd213498540faedb9f00d1b81cd9c 100644
--- a/webrtc/base/timeutils.cc
+++ b/webrtc/base/timeutils.cc
@@ -200,10 +200,12 @@ int64_t TimestampWrapAroundHandler::Unwrap(uint32_t ts) {
if (last_ts_ > 0xf0000000 && ts < 0x0fffffff) {
++num_wrap_;
}
+ } else if (num_wrap_ > 0 && (ts - last_ts_) >= 0x0fffffff) {
+ // Backwards wrap. Unwrap with last wrap count and don't update last_ts_.
+ return ts + ((num_wrap_ -1) << 32);
mflodman 2016/03/09 15:01:57 Functionality LG, but can this be written in an ea
sprang_webrtc 2016/03/09 15:40:30 Not without duplicating "last_ts = ts" or adding a
}
last_ts_ = ts;
- int64_t unwrapped_ts = ts + (num_wrap_ << 32);
- return unwrapped_ts;
+ return ts + (num_wrap_ << 32);
}
int64_t TmToSeconds(const std::tm& tm) {
« no previous file with comments | « no previous file | webrtc/video/video_quality_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698