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"
14 // A helper class used to convert current time ticks into RTP timestamp.
15 class RtpTimestampHelper
{
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
);
32 base::TimeTicks last_capture_time_
;
33 uint32 last_rtp_timestamp_
;
35 DISALLOW_COPY_AND_ASSIGN(RtpTimestampHelper
);
41 #endif // MEDIA_CAST_CAST_DEFINES_H_