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/net/pacing/paced_sender.h" | 5 #include "media/cast/transport/pacing/paced_sender.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 | 9 |
10 namespace media { | 10 namespace media { |
11 namespace cast { | 11 namespace cast { |
| 12 namespace transport { |
12 | 13 |
13 static const int64 kPacingIntervalMs = 10; | 14 static const int64 kPacingIntervalMs = 10; |
14 // Each frame will be split into no more than kPacingMaxBurstsPerFrame | 15 // Each frame will be split into no more than kPacingMaxBurstsPerFrame |
15 // bursts of packets. | 16 // bursts of packets. |
16 static const size_t kPacingMaxBurstsPerFrame = 3; | 17 static const size_t kPacingMaxBurstsPerFrame = 3; |
17 | 18 |
18 PacedSender::PacedSender(scoped_refptr<CastEnvironment> cast_environment, | 19 PacedSender::PacedSender(scoped_refptr<CastEnvironment> cast_environment, |
19 PacketSender* transport) | 20 PacketSender* transport) |
20 : cast_environment_(cast_environment), | 21 : cast_environment_(cast_environment), |
21 transport_(transport), | 22 transport_(transport), |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 void PacedSender::UpdateBurstSize(size_t packets_to_send) { | 141 void PacedSender::UpdateBurstSize(size_t packets_to_send) { |
141 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); | 142 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); |
142 packets_to_send = std::max(packets_to_send, | 143 packets_to_send = std::max(packets_to_send, |
143 resend_packet_list_.size() + packet_list_.size()); | 144 resend_packet_list_.size() + packet_list_.size()); |
144 | 145 |
145 packets_to_send += (kPacingMaxBurstsPerFrame - 1); // Round up. | 146 packets_to_send += (kPacingMaxBurstsPerFrame - 1); // Round up. |
146 burst_size_ = std::max(packets_to_send / kPacingMaxBurstsPerFrame, | 147 burst_size_ = std::max(packets_to_send / kPacingMaxBurstsPerFrame, |
147 burst_size_); | 148 burst_size_); |
148 } | 149 } |
149 | 150 |
| 151 } // namespace transport |
150 } // namespace cast | 152 } // namespace cast |
151 } // namespace media | 153 } // namespace media |
OLD | NEW |