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

Unified Diff: media/cast/rtp_timestamp_helper.cc

Issue 281453003: Cast: Simplify code path for RTCP sender report (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merged Created 6 years, 7 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 | « media/cast/rtp_timestamp_helper.h ('k') | media/cast/transport/cast_transport_config.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/cast/rtp_timestamp_helper.cc
diff --git a/media/cast/rtp_timestamp_helper.cc b/media/cast/rtp_timestamp_helper.cc
new file mode 100644
index 0000000000000000000000000000000000000000..a0c56c09eabdde82e7c6d4e1208813c672fb64ce
--- /dev/null
+++ b/media/cast/rtp_timestamp_helper.cc
@@ -0,0 +1,35 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "media/cast/rtp_timestamp_helper.h"
+
+namespace media {
+namespace cast {
+
+RtpTimestampHelper::RtpTimestampHelper(int frequency)
+ : frequency_(frequency),
+ last_rtp_timestamp_(0) {
+}
+
+RtpTimestampHelper::~RtpTimestampHelper() {
+}
+
+bool RtpTimestampHelper::GetCurrentTimeAsRtpTimestamp(
+ const base::TimeTicks& now, uint32* rtp_timestamp) const {
+ if (last_capture_time_.is_null())
+ return false;
+ base::TimeDelta elapsed_time = now - last_capture_time_;
+ *rtp_timestamp = last_rtp_timestamp_ + elapsed_time.InMilliseconds() *
+ frequency_ / base::Time::kMillisecondsPerSecond;
+ return true;
+}
+
+void RtpTimestampHelper::StoreLatestTime(
+ base::TimeTicks capture_time, uint32 rtp_timestamp) {
+ last_capture_time_ = capture_time;
+ last_rtp_timestamp_ = rtp_timestamp;
+}
+
+} // namespace cast
+} // namespace media
« no previous file with comments | « media/cast/rtp_timestamp_helper.h ('k') | media/cast/transport/cast_transport_config.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698