Initiation of corruption in IDB test is now *in* the test.
[chromium-blink-merge.git] / media / cast / rtp_timestamp_helper.h
blobb9c650c506317064c333357c83c1d44a40ab1d7d
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef MEDIA_CAST_RTP_TIMESTAMP_HELPER_H_
6 #define MEDIA_CAST_RTP_TIMESTAMP_HELPER_H_
8 #include "base/basictypes.h"
9 #include "base/time/time.h"
11 namespace media {
12 namespace cast {
14 // A helper class used to convert current time ticks into RTP timestamp.
15 class RtpTimestampHelper {
16 public:
17 explicit RtpTimestampHelper(int frequency);
18 ~RtpTimestampHelper();
20 // Compute a RTP timestamp using current time, last encoded time and
21 // last encoded RTP timestamp.
22 // Return true if |rtp_timestamp| is computed.
23 bool GetCurrentTimeAsRtpTimestamp(const base::TimeTicks& now,
24 uint32* rtp_timestamp) const;
26 // Store the capture time and the corresponding RTP timestamp for the
27 // last encoded frame.
28 void StoreLatestTime(base::TimeTicks capture_time, uint32 rtp_timestamp);
30 private:
31 int frequency_;
32 base::TimeTicks last_capture_time_;
33 uint32 last_rtp_timestamp_;
35 DISALLOW_COPY_AND_ASSIGN(RtpTimestampHelper);
38 } // namespace cast
39 } // namespace media
41 #endif // MEDIA_CAST_CAST_DEFINES_H_