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

Side by Side Diff: webrtc/system_wrappers/source/timestamp_extrapolator.cc

Issue 2776813002: Bug Fix: WebRTC Receiver Timestamp Jump Detection (Closed)
Patch Set: Style Created 3 years, 8 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 // Reset the extrapolator 70 // Reset the extrapolator
71 _rwLock->ReleaseLockExclusive(); 71 _rwLock->ReleaseLockExclusive();
72 Reset(tMs); 72 Reset(tMs);
73 _rwLock->AcquireLockExclusive(); 73 _rwLock->AcquireLockExclusive();
74 } 74 }
75 else 75 else
76 { 76 {
77 _prevMs = tMs; 77 _prevMs = tMs;
78 } 78 }
79 79
80 // Remove offset to prevent badly scaled matrices
81 tMs -= _startMs;
82
83 CheckForWrapArounds(ts90khz); 80 CheckForWrapArounds(ts90khz);
84 81
85 int64_t unwrapped_ts90khz = static_cast<int64_t>(ts90khz) + 82 int64_t unwrapped_ts90khz = static_cast<int64_t>(ts90khz) +
86 _wrapArounds * ((static_cast<int64_t>(1) << 32) - 1); 83 _wrapArounds * ((static_cast<int64_t>(1) << 32) - 1);
87 84
88 if (_prevUnwrappedTimestamp >= 0 && 85 if (_prevUnwrappedTimestamp >= 0 &&
86 std::abs(unwrapped_ts90khz - _prevUnwrappedTimestamp) >
87 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
88 {
89 // Time stamp jump more than 10s.
90 // We took this as a sign of a different stream, reset the extrapolator.
91 _rwLock->ReleaseLockExclusive();
92 Reset(tMs);
93 _rwLock->AcquireLockExclusive();
94 }
95
96 // Remove offset to prevent badly scaled matrices
97 tMs -= _startMs;
98
99 if (_prevUnwrappedTimestamp >= 0 &&
89 unwrapped_ts90khz < _prevUnwrappedTimestamp) 100 unwrapped_ts90khz < _prevUnwrappedTimestamp)
90 { 101 {
91 // Drop reordered frames. 102 // Drop reordered frames.
92 _rwLock->ReleaseLockExclusive(); 103 _rwLock->ReleaseLockExclusive();
93 return; 104 return;
94 } 105 }
95 106
96 if (_firstAfterReset) 107 if (_firstAfterReset)
97 { 108 {
98 // Make an initial guess of the offset, 109 // Make an initial guess of the offset,
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 if (_detectorAccumulatorPos > _alarmThreshold || _detectorAccumulatorNeg < - _alarmThreshold) 236 if (_detectorAccumulatorPos > _alarmThreshold || _detectorAccumulatorNeg < - _alarmThreshold)
226 { 237 {
227 // Alarm 238 // Alarm
228 _detectorAccumulatorPos = _detectorAccumulatorNeg = 0; 239 _detectorAccumulatorPos = _detectorAccumulatorNeg = 0;
229 return true; 240 return true;
230 } 241 }
231 return false; 242 return false;
232 } 243 }
233 244
234 } 245 }
OLDNEW
« 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