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 #include "media/cast/rtcp/rtcp.h" | 5 #include "media/cast/rtcp/rtcp.h" |
6 | 6 |
7 #include "base/rand_util.h" | 7 #include "base/rand_util.h" |
8 #include "media/cast/cast_config.h" | 8 #include "media/cast/cast_config.h" |
9 #include "media/cast/cast_defines.h" | 9 #include "media/cast/cast_defines.h" |
10 #include "media/cast/cast_environment.h" | 10 #include "media/cast/cast_environment.h" |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 } | 208 } |
209 | 209 |
210 Rtcp::~Rtcp() {} | 210 Rtcp::~Rtcp() {} |
211 | 211 |
212 // static | 212 // static |
213 bool Rtcp::IsRtcpPacket(const uint8* packet, size_t length) { | 213 bool Rtcp::IsRtcpPacket(const uint8* packet, size_t length) { |
214 DCHECK_GE(length, kMinLengthOfRtcp) << "Invalid RTCP packet"; | 214 DCHECK_GE(length, kMinLengthOfRtcp) << "Invalid RTCP packet"; |
215 if (length < kMinLengthOfRtcp) return false; | 215 if (length < kMinLengthOfRtcp) return false; |
216 | 216 |
217 uint8 packet_type = packet[1]; | 217 uint8 packet_type = packet[1]; |
218 if (packet_type >= kPacketTypeLow && packet_type <= kPacketTypeHigh) { | 218 if (packet_type >= transport::kPacketTypeLow && |
| 219 packet_type <= transport::kPacketTypeHigh) { |
219 return true; | 220 return true; |
220 } | 221 } |
221 return false; | 222 return false; |
222 } | 223 } |
223 | 224 |
224 // static | 225 // static |
225 uint32 Rtcp::GetSsrcOfSender(const uint8* rtcp_buffer, size_t length) { | 226 uint32 Rtcp::GetSsrcOfSender(const uint8* rtcp_buffer, size_t length) { |
226 DCHECK_GE(length, kMinLengthOfRtcp) << "Invalid RTCP packet"; | 227 DCHECK_GE(length, kMinLengthOfRtcp) << "Invalid RTCP packet"; |
227 uint32 ssrc_of_sender; | 228 uint32 ssrc_of_sender; |
228 net::BigEndianReader big_endian_reader(rtcp_buffer, length); | 229 net::BigEndianReader big_endian_reader(rtcp_buffer, length); |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
500 int random = base::RandInt(0, 999); | 501 int random = base::RandInt(0, 999); |
501 base::TimeDelta time_to_next = (rtcp_interval_ / 2) + | 502 base::TimeDelta time_to_next = (rtcp_interval_ / 2) + |
502 (rtcp_interval_ * random / 1000); | 503 (rtcp_interval_ * random / 1000); |
503 | 504 |
504 base::TimeTicks now = cast_environment_->Clock()->NowTicks(); | 505 base::TimeTicks now = cast_environment_->Clock()->NowTicks(); |
505 next_time_to_send_rtcp_ = now + time_to_next; | 506 next_time_to_send_rtcp_ = now + time_to_next; |
506 } | 507 } |
507 | 508 |
508 } // namespace cast | 509 } // namespace cast |
509 } // namespace media | 510 } // namespace media |
OLD | NEW |