OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef MEDIA_CAST_CAST_DEFINES_H_ | 5 #ifndef MEDIA_CAST_CAST_DEFINES_H_ |
6 #define MEDIA_CAST_CAST_DEFINES_H_ | 6 #define MEDIA_CAST_CAST_DEFINES_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 ntp_time_us - | 188 ntp_time_us - |
189 (kUnixEpochInNtpSeconds * base::Time::kMicrosecondsPerSecond)); | 189 (kUnixEpochInNtpSeconds * base::Time::kMicrosecondsPerSecond)); |
190 return base::TimeTicks::UnixEpoch() + elapsed_since_unix_epoch; | 190 return base::TimeTicks::UnixEpoch() + elapsed_since_unix_epoch; |
191 } | 191 } |
192 | 192 |
193 inline base::TimeDelta RtpDeltaToTimeDelta(int64 rtp_delta, int rtp_timebase) { | 193 inline base::TimeDelta RtpDeltaToTimeDelta(int64 rtp_delta, int rtp_timebase) { |
194 DCHECK_GT(rtp_timebase, 0); | 194 DCHECK_GT(rtp_timebase, 0); |
195 return rtp_delta * base::TimeDelta::FromSeconds(1) / rtp_timebase; | 195 return rtp_delta * base::TimeDelta::FromSeconds(1) / rtp_timebase; |
196 } | 196 } |
197 | 197 |
| 198 inline int64 TimeDeltaToRtpDelta(base::TimeDelta delta, int rtp_timebase) { |
| 199 DCHECK_GT(rtp_timebase, 0); |
| 200 return delta * rtp_timebase / base::TimeDelta::FromSeconds(1); |
| 201 } |
| 202 |
198 } // namespace cast | 203 } // namespace cast |
199 } // namespace media | 204 } // namespace media |
200 | 205 |
201 #endif // MEDIA_CAST_CAST_DEFINES_H_ | 206 #endif // MEDIA_CAST_CAST_DEFINES_H_ |
OLD | NEW |