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

Side by Side Diff: webrtc/base/timestampaligner.h

Issue 2325563002: New method TimestampAligner::TranslateTimestamp (Closed)
Patch Set: Make translated timestamps monotonous over reset. Created 4 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 unified diff | Download patch
« no previous file with comments | « no previous file | webrtc/base/timestampaligner.cc » ('j') | webrtc/base/timestampaligner.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2016 The WebRTC Project Authors. All rights reserved. 2 * Copyright (c) 2016 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
11 #ifndef WEBRTC_BASE_TIMESTAMPALIGNER_H_ 11 #ifndef WEBRTC_BASE_TIMESTAMPALIGNER_H_
12 #define WEBRTC_BASE_TIMESTAMPALIGNER_H_ 12 #define WEBRTC_BASE_TIMESTAMPALIGNER_H_
13 13
14 #include "webrtc/base/basictypes.h" 14 #include "webrtc/base/basictypes.h"
15 #include "webrtc/base/constructormagic.h" 15 #include "webrtc/base/constructormagic.h"
16 #include "webrtc/base/optional.h"
17 16
18 namespace rtc { 17 namespace rtc {
19 18
20 // This class is not thread safe, so all calls to it must be synchronized 19 // This class is not thread safe, so all calls to it must be synchronized
21 // externally. 20 // externally.
22 class TimestampAligner { 21 class TimestampAligner {
perkj_webrtc 2016/09/08 13:41:05 Add comment about the purpose of this class please
nisse-webrtc 2016/09/09 13:32:44 Done.
23 public: 22 public:
24 TimestampAligner(); 23 TimestampAligner();
25 ~TimestampAligner(); 24 ~TimestampAligner();
26 25
27 public: 26 public:
27 // Recommended function for code outside of webrtc. |camera_time_us|
perkj_webrtc 2016/09/08 13:41:05 Why only outside webrtc and what does that mean? W
28 // is assumed to be accurate, but with an unknown epoch and
29 // frequency drift. |system_time_us| is time according to
30 // rtc::TimeMicros(), preferably read as soon as possible when the
31 // frame is received. It may have poor accuracy due to poor
perkj_webrtc 2016/09/08 13:41:05 /s frame is received -> frame is captured
nisse-webrtc 2016/09/09 13:32:43 Done.
32 // resolution or scheduling delays. Returns the translated
33 // timestamp.
34 int64_t TranslateTimestamp(int64_t camera_time_us, int64_t system_time_us);
35
28 // Update the estimated offset between camera time and system monotonic time. 36 // Update the estimated offset between camera time and system monotonic time.
29 int64_t UpdateOffset(int64_t camera_time_us, int64_t system_time_us); 37 int64_t UpdateOffset(int64_t camera_time_us, int64_t system_time_us);
perkj_webrtc 2016/09/08 13:41:05 make private ?
nisse-webrtc 2016/09/09 13:32:43 Done. (Or rather protected, to make it available f
30 38
39 // Clip timestamp, return value is larger than the previous
40 // timestamp but no larger than |system_time_us|.
31 int64_t ClipTimestamp(int64_t filtered_time_us, int64_t system_time_us); 41 int64_t ClipTimestamp(int64_t filtered_time_us, int64_t system_time_us);
perkj_webrtc 2016/09/08 13:41:05 make private ?
nisse-webrtc 2016/09/09 13:32:43 Same here.
32 42
33 private: 43 private:
34 // State for the timestamp translation. 44 // State for the timestamp translation.
35 int frames_seen_; 45 int frames_seen_;
36 // Estimated offset between camera time and system monotonic time. 46 // Estimated offset between camera time and system monotonic time.
37 int64_t offset_us_; 47 int64_t offset_us_;
38 48
39 // State for timestamp clipping, applied after the filter, to ensure 49 // State for timestamp clipping, applied after the filter, to ensure
40 // that translated timestamps are monotonic and not in the future. 50 // that translated timestamps are monotonous and not in the future.
41 // Subtracted from the translated timestamps. 51 // Subtracted from the translated timestamps.
42 int64_t clip_bias_us_; 52 int64_t clip_bias_us_;
43 rtc::Optional<int64_t> prev_translated_time_us_; 53 int64_t prev_translated_time_us_;
44 RTC_DISALLOW_COPY_AND_ASSIGN(TimestampAligner); 54 RTC_DISALLOW_COPY_AND_ASSIGN(TimestampAligner);
45 }; 55 };
46 56
47 } // namespace rtc 57 } // namespace rtc
48 58
49 #endif // WEBRTC_BASE_TIMESTAMPALIGNER_H_ 59 #endif // WEBRTC_BASE_TIMESTAMPALIGNER_H_
OLDNEW
« no previous file with comments | « no previous file | webrtc/base/timestampaligner.cc » ('j') | webrtc/base/timestampaligner.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698