| 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 >= transport::kPacketTypeLow && | 219 if (packet_type >= kPacketTypeLow && packet_type <= kPacketTypeHigh) { |
| 220 packet_type <= transport::kPacketTypeHigh) { | |
| 221 return true; | 220 return true; |
| 222 } | 221 } |
| 223 return false; | 222 return false; |
| 224 } | 223 } |
| 225 | 224 |
| 226 // static | 225 // static |
| 227 uint32 Rtcp::GetSsrcOfSender(const uint8* rtcp_buffer, size_t length) { | 226 uint32 Rtcp::GetSsrcOfSender(const uint8* rtcp_buffer, size_t length) { |
| 228 DCHECK_GE(length, kMinLengthOfRtcp) << "Invalid RTCP packet"; | 227 DCHECK_GE(length, kMinLengthOfRtcp) << "Invalid RTCP packet"; |
| 229 uint32 ssrc_of_sender; | 228 uint32 ssrc_of_sender; |
| 230 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... |
| 502 int random = base::RandInt(0, 999); | 501 int random = base::RandInt(0, 999); |
| 503 base::TimeDelta time_to_next = (rtcp_interval_ / 2) + | 502 base::TimeDelta time_to_next = (rtcp_interval_ / 2) + |
| 504 (rtcp_interval_ * random / 1000); | 503 (rtcp_interval_ * random / 1000); |
| 505 | 504 |
| 506 base::TimeTicks now = cast_environment_->Clock()->NowTicks(); | 505 base::TimeTicks now = cast_environment_->Clock()->NowTicks(); |
| 507 next_time_to_send_rtcp_ = now + time_to_next; | 506 next_time_to_send_rtcp_ = now + time_to_next; |
| 508 } | 507 } |
| 509 | 508 |
| 510 } // namespace cast | 509 } // namespace cast |
| 511 } // namespace media | 510 } // namespace media |
| OLD | NEW |