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

Unified Diff: webrtc/base/timestampaligner.h

Issue 2017443003: Implement timestamp translation/filter in VideoCapturer. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Add missing include of math.h. Created 4 years, 6 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 | « webrtc/base/base.gyp ('k') | webrtc/base/timestampaligner.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/base/timestampaligner.h
diff --git a/webrtc/base/timestampaligner.h b/webrtc/base/timestampaligner.h
new file mode 100644
index 0000000000000000000000000000000000000000..35008d38c7169e37f9f86faa492dcc6b2c43e641
--- /dev/null
+++ b/webrtc/base/timestampaligner.h
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2016 The WebRTC Project Authors. All rights reserved.
+ *
+ * Use of this source code is governed by a BSD-style license
+ * that can be found in the LICENSE file in the root of the source
+ * tree. An additional intellectual property rights grant can be found
+ * in the file PATENTS. All contributing project authors may
+ * be found in the AUTHORS file in the root of the source tree.
+ */
+
+#ifndef WEBRTC_BASE_TIMESTAMPALIGNER_H_
+#define WEBRTC_BASE_TIMESTAMPALIGNER_H_
+
+#include "webrtc/base/basictypes.h"
+#include "webrtc/base/constructormagic.h"
+#include "webrtc/base/optional.h"
+
+namespace rtc {
+
+class TimestampAligner {
+ public:
+ TimestampAligner();
+ ~TimestampAligner();
+
+ public:
+ // Update the estimated offset between camera time and system monotonic time.
+ int64_t UpdateOffset(int64_t camera_time_us, int64_t system_time_us);
+
+ int64_t ClipTimestamp(int64_t filtered_time_us, int64_t system_time_us);
+
+ private:
+ // State for the timestamp translation.
+ int frames_seen_;
+ // Estimated offset between camera time and system monotonic time.
+ int64_t offset_us_;
+
+ // State for timestamp clipping, applied after the filter, to ensure
+ // that translated timestamps are monotonic and not in the future.
+ // Subtracted from the translated timestamps.
+ int64_t clip_bias_us_;
+ rtc::Optional<int64_t> prev_translated_time_us_;
+ RTC_DISALLOW_COPY_AND_ASSIGN(TimestampAligner);
+};
+
+} // namespace rtc
+
+#endif // WEBRTC_BASE_TIMESTAMPALIGNER_H_
« no previous file with comments | « webrtc/base/base.gyp ('k') | webrtc/base/timestampaligner.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698