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 <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 | 10 |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 int64 ntp_time_us = static_cast<int64>(ntp_seconds) * | 125 int64 ntp_time_us = static_cast<int64>(ntp_seconds) * |
126 base::Time::kMicrosecondsPerSecond + | 126 base::Time::kMicrosecondsPerSecond + |
127 static_cast<int64>(ntp_fractions) / kMagicFractionalUnit; | 127 static_cast<int64>(ntp_fractions) / kMagicFractionalUnit; |
128 | 128 |
129 base::TimeDelta elapsed_since_unix_epoch = | 129 base::TimeDelta elapsed_since_unix_epoch = |
130 base::TimeDelta::FromMicroseconds(ntp_time_us - | 130 base::TimeDelta::FromMicroseconds(ntp_time_us - |
131 (kUnixEpochInNtpSeconds * base::Time::kMicrosecondsPerSecond)); | 131 (kUnixEpochInNtpSeconds * base::Time::kMicrosecondsPerSecond)); |
132 return base::TimeTicks::UnixEpoch() + elapsed_since_unix_epoch; | 132 return base::TimeTicks::UnixEpoch() + elapsed_since_unix_epoch; |
133 } | 133 } |
134 | 134 |
| 135 inline uint32 GetVideoRtpTimestamp(const base::TimeTicks& time_ticks) { |
| 136 base::TimeTicks zero_time; |
| 137 base::TimeDelta recorded_delta = time_ticks - zero_time; |
| 138 // Timestamp is in 90 KHz for video. |
| 139 return static_cast<uint32>(recorded_delta.InMilliseconds() * 90); |
| 140 } |
| 141 |
135 } // namespace cast | 142 } // namespace cast |
136 } // namespace media | 143 } // namespace media |
137 | 144 |
138 #endif // MEDIA_CAST_CAST_DEFINES_H_ | 145 #endif // MEDIA_CAST_CAST_DEFINES_H_ |
OLD | NEW |