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_TRANSPORT_CAST_TRANSPORT_DEFINES_H_ | 5 #ifndef MEDIA_CAST_TRANSPORT_CAST_TRANSPORT_DEFINES_H_ |
6 #define MEDIA_CAST_TRANSPORT_CAST_TRANSPORT_DEFINES_H_ | 6 #define MEDIA_CAST_TRANSPORT_CAST_TRANSPORT_DEFINES_H_ |
7 | 7 |
| 8 #include <stdint.h> |
| 9 |
8 #include <map> | 10 #include <map> |
9 #include <set> | 11 #include <set> |
10 #include <string> | 12 #include <string> |
11 | 13 |
12 #include "base/basictypes.h" | 14 #include "base/basictypes.h" |
13 #include "base/time/time.h" | 15 #include "base/time/time.h" |
14 | 16 |
15 namespace media { | 17 namespace media { |
16 namespace cast { | 18 namespace cast { |
17 namespace transport { | 19 namespace transport { |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 break; | 137 break; |
136 } | 138 } |
137 return (wrap_count << 8) + over_the_wire_frame_id; | 139 return (wrap_count << 8) + over_the_wire_frame_id; |
138 } | 140 } |
139 | 141 |
140 private: | 142 private: |
141 enum Range { kLowRange, kMiddleRange, kHighRange, }; | 143 enum Range { kLowRange, kMiddleRange, kHighRange, }; |
142 | 144 |
143 static const uint8 kLowRangeThreshold = 63; | 145 static const uint8 kLowRangeThreshold = 63; |
144 static const uint8 kHighRangeThreshold = 192; | 146 static const uint8 kHighRangeThreshold = 192; |
145 static const uint32 kStartFrameId = GG_UINT32_C(0xffffffff); | 147 static const uint32 kStartFrameId = UINT32_C(0xffffffff); |
146 | 148 |
147 bool first_; | 149 bool first_; |
148 uint32 frame_id_wrap_count_; | 150 uint32 frame_id_wrap_count_; |
149 Range range_; | 151 Range range_; |
150 | 152 |
151 DISALLOW_COPY_AND_ASSIGN(FrameIdWrapHelper); | 153 DISALLOW_COPY_AND_ASSIGN(FrameIdWrapHelper); |
152 }; | 154 }; |
153 | 155 |
154 inline uint32 GetVideoRtpTimestamp(const base::TimeTicks& time_ticks) { | 156 inline uint32 GetVideoRtpTimestamp(const base::TimeTicks& time_ticks) { |
155 base::TimeTicks zero_time; | 157 base::TimeTicks zero_time; |
156 base::TimeDelta recorded_delta = time_ticks - zero_time; | 158 base::TimeDelta recorded_delta = time_ticks - zero_time; |
157 // Timestamp is in 90 KHz for video. | 159 // Timestamp is in 90 KHz for video. |
158 return static_cast<uint32>(recorded_delta.InMilliseconds() * 90); | 160 return static_cast<uint32>(recorded_delta.InMilliseconds() * 90); |
159 } | 161 } |
160 | 162 |
161 } // namespace transport | 163 } // namespace transport |
162 } // namespace cast | 164 } // namespace cast |
163 } // namespace media | 165 } // namespace media |
164 | 166 |
165 #endif // MEDIA_CAST_TRANSPORT_CAST_TRANSPORT_DEFINES_H_ | 167 #endif // MEDIA_CAST_TRANSPORT_CAST_TRANSPORT_DEFINES_H_ |
OLD | NEW |