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