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

Unified Diff: media/cast/rtp_timestamp_helper.h

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/rtcp/rtcp_unittest.cc ('k') | media/cast/rtp_timestamp_helper.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/cast/rtp_timestamp_helper.h
diff --git a/media/cast/rtp_timestamp_helper.h b/media/cast/rtp_timestamp_helper.h
new file mode 100644
index 0000000000000000000000000000000000000000..b9c650c506317064c333357c83c1d44a40ab1d7d
--- /dev/null
+++ b/media/cast/rtp_timestamp_helper.h
@@ -0,0 +1,41 @@
+// 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.
+
+#ifndef MEDIA_CAST_RTP_TIMESTAMP_HELPER_H_
+#define MEDIA_CAST_RTP_TIMESTAMP_HELPER_H_
+
+#include "base/basictypes.h"
+#include "base/time/time.h"
+
+namespace media {
+namespace cast {
+
+// A helper class used to convert current time ticks into RTP timestamp.
+class RtpTimestampHelper {
+ public:
+ explicit RtpTimestampHelper(int frequency);
+ ~RtpTimestampHelper();
+
+ // Compute a RTP timestamp using current time, last encoded time and
+ // last encoded RTP timestamp.
+ // Return true if |rtp_timestamp| is computed.
+ bool GetCurrentTimeAsRtpTimestamp(const base::TimeTicks& now,
+ uint32* rtp_timestamp) const;
+
+ // Store the capture time and the corresponding RTP timestamp for the
+ // last encoded frame.
+ void StoreLatestTime(base::TimeTicks capture_time, uint32 rtp_timestamp);
+
+ private:
+ int frequency_;
+ base::TimeTicks last_capture_time_;
+ uint32 last_rtp_timestamp_;
+
+ DISALLOW_COPY_AND_ASSIGN(RtpTimestampHelper);
+};
+
+} // namespace cast
+} // namespace media
+
+#endif // MEDIA_CAST_CAST_DEFINES_H_
« no previous file with comments | « media/cast/rtcp/rtcp_unittest.cc ('k') | media/cast/rtp_timestamp_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698