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 // 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/congestion_control/congestion_control.h" | 16 #include "media/cast/sender/congestion_control.h" |
17 | 17 |
18 #include "base/logging.h" | 18 #include "base/logging.h" |
19 #include "media/cast/cast_config.h" | 19 #include "media/cast/cast_config.h" |
20 #include "media/cast/cast_defines.h" | 20 #include "media/cast/cast_defines.h" |
21 | 21 |
22 namespace media { | 22 namespace media { |
23 namespace cast { | 23 namespace cast { |
24 | 24 |
25 // This means that we *try* to keep our buffer 90% empty. | 25 // This means that we *try* to keep our buffer 90% empty. |
26 // If it is less full, we increase the bandwidth, if it is more | 26 // If it is less full, we increase the bandwidth, if it is more |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 VLOG(3) << " FBR:" << (bits_per_second / 1E6) | 188 VLOG(3) << " FBR:" << (bits_per_second / 1E6) |
189 << " EBF:" << empty_buffer_fraction | 189 << " EBF:" << empty_buffer_fraction |
190 << " SBR:" << (safe_bitrate / 1E6); | 190 << " SBR:" << (safe_bitrate / 1E6); |
191 bits_per_second = std::max(bits_per_second, min_bitrate_configured_); | 191 bits_per_second = std::max(bits_per_second, min_bitrate_configured_); |
192 bits_per_second = std::min(bits_per_second, max_bitrate_configured_); | 192 bits_per_second = std::min(bits_per_second, max_bitrate_configured_); |
193 return bits_per_second; | 193 return bits_per_second; |
194 } | 194 } |
195 | 195 |
196 } // namespace cast | 196 } // namespace cast |
197 } // namespace media | 197 } // namespace media |
OLD | NEW |