OLD | NEW |
| (Empty) |
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. | |
4 | |
5 #ifndef MEDIA_CAST_SENDER_RTP_TIMESTAMP_HELPER_H_ | |
6 #define MEDIA_CAST_SENDER_RTP_TIMESTAMP_HELPER_H_ | |
7 | |
8 #include "base/basictypes.h" | |
9 #include "base/time/time.h" | |
10 | |
11 namespace media { | |
12 namespace cast { | |
13 | |
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(); | |
19 | |
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; | |
25 | |
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); | |
29 | |
30 private: | |
31 int frequency_; | |
32 base::TimeTicks last_capture_time_; | |
33 uint32 last_rtp_timestamp_; | |
34 | |
35 DISALLOW_COPY_AND_ASSIGN(RtpTimestampHelper); | |
36 }; | |
37 | |
38 } // namespace cast | |
39 } // namespace media | |
40 | |
41 #endif // MEDIA_CAST_SENDER_RTP_TIMESTAMP_HELPER_H_ | |
OLD | NEW |