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

Unified Diff: webrtc/system_wrappers/source/timestamp_extrapolator.cc

Issue 2776813002: Bug Fix: WebRTC Receiver Timestamp Jump Detection (Closed)
Patch Set: Style Created 3 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/system_wrappers/source/timestamp_extrapolator.cc
diff --git a/webrtc/system_wrappers/source/timestamp_extrapolator.cc b/webrtc/system_wrappers/source/timestamp_extrapolator.cc
index c7ed856a54742222434e898780d46393981dbbb1..b030799b1a96a0eed9386edd557d49fb61993326 100644
--- a/webrtc/system_wrappers/source/timestamp_extrapolator.cc
+++ b/webrtc/system_wrappers/source/timestamp_extrapolator.cc
@@ -77,15 +77,26 @@ TimestampExtrapolator::Update(int64_t tMs, uint32_t ts90khz)
_prevMs = tMs;
}
- // Remove offset to prevent badly scaled matrices
- tMs -= _startMs;
-
CheckForWrapArounds(ts90khz);
int64_t unwrapped_ts90khz = static_cast<int64_t>(ts90khz) +
_wrapArounds * ((static_cast<int64_t>(1) << 32) - 1);
if (_prevUnwrappedTimestamp >= 0 &&
+ std::abs(unwrapped_ts90khz - _prevUnwrappedTimestamp) >
+ 90 * 1000 * 10)
nisse-webrtc 2017/03/30 06:37:07 This limit deserves a symbolic name. And I think
stefan-webrtc 2017/03/30 06:55:14 I think this will trigger cases where we may not w
qiangchen 2017/03/30 17:47:38 That's a good idea, and I do see the following cod
+ {
+ // Time stamp jump more than 10s.
+ // We took this as a sign of a different stream, reset the extrapolator.
+ _rwLock->ReleaseLockExclusive();
+ Reset(tMs);
+ _rwLock->AcquireLockExclusive();
+ }
+
+ // Remove offset to prevent badly scaled matrices
+ tMs -= _startMs;
+
+ if (_prevUnwrappedTimestamp >= 0 &&
unwrapped_ts90khz < _prevUnwrappedTimestamp)
{
// Drop reordered frames.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698