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" |
11 #include "media/cast/rtcp/rtcp_defines.h" | 11 #include "media/cast/rtcp/rtcp_defines.h" |
12 #include "media/cast/rtcp/rtcp_receiver.h" | 12 #include "media/cast/rtcp/rtcp_receiver.h" |
13 #include "media/cast/rtcp/rtcp_sender.h" | 13 #include "media/cast/rtcp/rtcp_sender.h" |
14 #include "media/cast/rtcp/rtcp_utility.h" | 14 #include "media/cast/rtcp/rtcp_utility.h" |
| 15 #include "media/cast/transport/cast_transport_defines.h" |
15 #include "net/base/big_endian.h" | 16 #include "net/base/big_endian.h" |
16 | 17 |
17 namespace media { | 18 namespace media { |
18 namespace cast { | 19 namespace cast { |
19 | 20 |
20 static const int kMaxRttMs = 10000; // 10 seconds. | 21 static const int kMaxRttMs = 10000; // 10 seconds. |
21 | 22 |
22 // Time limit for received RTCP messages when we stop using it for lip-sync. | 23 // Time limit for received RTCP messages when we stop using it for lip-sync. |
23 static const int64 kMaxDiffSinceReceivedRtcpMs = 100000; // 100 seconds. | 24 static const int64 kMaxDiffSinceReceivedRtcpMs = 100000; // 100 seconds. |
24 | 25 |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 } | 165 } |
165 } | 166 } |
166 | 167 |
167 private: | 168 private: |
168 Rtcp* rtcp_; | 169 Rtcp* rtcp_; |
169 scoped_refptr<CastEnvironment> cast_environment_; | 170 scoped_refptr<CastEnvironment> cast_environment_; |
170 }; | 171 }; |
171 | 172 |
172 Rtcp::Rtcp(scoped_refptr<CastEnvironment> cast_environment, | 173 Rtcp::Rtcp(scoped_refptr<CastEnvironment> cast_environment, |
173 RtcpSenderFeedback* sender_feedback, | 174 RtcpSenderFeedback* sender_feedback, |
174 PacedPacketSender* paced_packet_sender, | 175 transport::PacedPacketSender* paced_packet_sender, |
175 RtpSenderStatistics* rtp_sender_statistics, | 176 RtpSenderStatistics* rtp_sender_statistics, |
176 RtpReceiverStatistics* rtp_receiver_statistics, | 177 RtpReceiverStatistics* rtp_receiver_statistics, |
177 RtcpMode rtcp_mode, | 178 RtcpMode rtcp_mode, |
178 const base::TimeDelta& rtcp_interval, | 179 const base::TimeDelta& rtcp_interval, |
179 uint32 local_ssrc, | 180 uint32 local_ssrc, |
180 uint32 remote_ssrc, | 181 uint32 remote_ssrc, |
181 const std::string& c_name) | 182 const std::string& c_name) |
182 : rtcp_interval_(rtcp_interval), | 183 : rtcp_interval_(rtcp_interval), |
183 rtcp_mode_(rtcp_mode), | 184 rtcp_mode_(rtcp_mode), |
184 local_ssrc_(local_ssrc), | 185 local_ssrc_(local_ssrc), |
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
497 int random = base::RandInt(0, 999); | 498 int random = base::RandInt(0, 999); |
498 base::TimeDelta time_to_next = (rtcp_interval_ / 2) + | 499 base::TimeDelta time_to_next = (rtcp_interval_ / 2) + |
499 (rtcp_interval_ * random / 1000); | 500 (rtcp_interval_ * random / 1000); |
500 | 501 |
501 base::TimeTicks now = cast_environment_->Clock()->NowTicks(); | 502 base::TimeTicks now = cast_environment_->Clock()->NowTicks(); |
502 next_time_to_send_rtcp_ = now + time_to_next; | 503 next_time_to_send_rtcp_ = now + time_to_next; |
503 } | 504 } |
504 | 505 |
505 } // namespace cast | 506 } // namespace cast |
506 } // namespace media | 507 } // namespace media |
OLD | NEW |