OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 // The purpose of this file is determine what bitrate to use for mirroring. | 5 // The purpose of this file is determine what bitrate to use for mirroring. |
6 // Ideally this should be as much as possible, without causing any frames to | 6 // Ideally this should be as much as possible, without causing any frames to |
7 // arrive late. | 7 // arrive late. |
8 | 8 |
9 // The current algorithm is to measure how much bandwidth we've been using | 9 // The current algorithm is to measure how much bandwidth we've been using |
10 // recently. We also keep track of how much data has been queued up for sending | 10 // recently. We also keep track of how much data has been queued up for sending |
11 // in a virtual "buffer" (this virtual buffer represents all the buffers between | 11 // in a virtual "buffer" (this virtual buffer represents all the buffers between |
12 // the sender and the receiver, including retransmissions and so forth.) | 12 // the sender and the receiver, including retransmissions and so forth.) |
13 // If we estimate that our virtual buffer is mostly empty, we try to use | 13 // If we estimate that our virtual buffer is mostly empty, we try to use |
14 // more bandwidth than our recent usage, otherwise we use less. | 14 // more bandwidth than our recent usage, otherwise we use less. |
15 | 15 |
16 #include "media/cast/sender/congestion_control.h" | 16 #include "media/cast/sender/congestion_control.h" |
17 | 17 |
18 #include <algorithm> | 18 #include <algorithm> |
19 #include <deque> | 19 #include <deque> |
20 | 20 |
21 #include "base/logging.h" | 21 #include "base/logging.h" |
| 22 #include "base/macros.h" |
22 #include "base/trace_event/trace_event.h" | 23 #include "base/trace_event/trace_event.h" |
23 #include "media/cast/cast_defines.h" | 24 #include "media/cast/cast_defines.h" |
24 #include "media/cast/constants.h" | 25 #include "media/cast/constants.h" |
25 | 26 |
26 namespace media { | 27 namespace media { |
27 namespace cast { | 28 namespace cast { |
28 | 29 |
29 class AdaptiveCongestionControl : public CongestionControl { | 30 class AdaptiveCongestionControl : public CongestionControl { |
30 public: | 31 public: |
31 AdaptiveCongestionControl(base::TickClock* clock, | 32 AdaptiveCongestionControl(base::TickClock* clock, |
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
364 empty_buffer_fraction); | 365 empty_buffer_fraction); |
365 bits_per_second = std::min(bits_per_second, soft_max_bitrate); | 366 bits_per_second = std::min(bits_per_second, soft_max_bitrate); |
366 bits_per_second = std::max(bits_per_second, min_bitrate_configured_); | 367 bits_per_second = std::max(bits_per_second, min_bitrate_configured_); |
367 bits_per_second = std::min(bits_per_second, max_bitrate_configured_); | 368 bits_per_second = std::min(bits_per_second, max_bitrate_configured_); |
368 | 369 |
369 return bits_per_second; | 370 return bits_per_second; |
370 } | 371 } |
371 | 372 |
372 } // namespace cast | 373 } // namespace cast |
373 } // namespace media | 374 } // namespace media |
OLD | NEW |