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 |
(...skipping 15 matching lines...) Expand all Loading... |
26 public: | 26 public: |
27 AdaptiveCongestionControl(base::TickClock* clock, | 27 AdaptiveCongestionControl(base::TickClock* clock, |
28 uint32 max_bitrate_configured, | 28 uint32 max_bitrate_configured, |
29 uint32 min_bitrate_configured, | 29 uint32 min_bitrate_configured, |
30 double max_frame_rate); | 30 double max_frame_rate); |
31 | 31 |
32 virtual ~AdaptiveCongestionControl() override; | 32 virtual ~AdaptiveCongestionControl() override; |
33 | 33 |
34 virtual void UpdateRtt(base::TimeDelta rtt) override; | 34 virtual void UpdateRtt(base::TimeDelta rtt) override; |
35 | 35 |
36 virtual void UpdateTargetPlayoutDelay(base::TimeDelta delay) OVERRIDE; | 36 virtual void UpdateTargetPlayoutDelay(base::TimeDelta delay) override; |
37 | 37 |
38 // Called when an encoded frame is sent to the transport. | 38 // Called when an encoded frame is sent to the transport. |
39 virtual void SendFrameToTransport(uint32 frame_id, | 39 virtual void SendFrameToTransport(uint32 frame_id, |
40 size_t frame_size, | 40 size_t frame_size, |
41 base::TimeTicks when) override; | 41 base::TimeTicks when) override; |
42 | 42 |
43 // Called when we receive an ACK for a frame. | 43 // Called when we receive an ACK for a frame. |
44 virtual void AckFrame(uint32 frame_id, base::TimeTicks when) override; | 44 virtual void AckFrame(uint32 frame_id, base::TimeTicks when) override; |
45 | 45 |
46 // Returns the bitrate we should use for the next frame. | 46 // Returns the bitrate we should use for the next frame. |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 }; | 94 }; |
95 | 95 |
96 class FixedCongestionControl : public CongestionControl { | 96 class FixedCongestionControl : public CongestionControl { |
97 public: | 97 public: |
98 FixedCongestionControl(uint32 bitrate) : bitrate_(bitrate) {} | 98 FixedCongestionControl(uint32 bitrate) : bitrate_(bitrate) {} |
99 virtual ~FixedCongestionControl() override {} | 99 virtual ~FixedCongestionControl() override {} |
100 | 100 |
101 virtual void UpdateRtt(base::TimeDelta rtt) override { | 101 virtual void UpdateRtt(base::TimeDelta rtt) override { |
102 } | 102 } |
103 | 103 |
104 virtual void UpdateTargetPlayoutDelay(base::TimeDelta delay) OVERRIDE { | 104 virtual void UpdateTargetPlayoutDelay(base::TimeDelta delay) override { |
105 } | 105 } |
106 | 106 |
107 // Called when an encoded frame is sent to the transport. | 107 // Called when an encoded frame is sent to the transport. |
108 virtual void SendFrameToTransport(uint32 frame_id, | 108 virtual void SendFrameToTransport(uint32 frame_id, |
109 size_t frame_size, | 109 size_t frame_size, |
110 base::TimeTicks when) override { | 110 base::TimeTicks when) override { |
111 } | 111 } |
112 | 112 |
113 // Called when we receive an ACK for a frame. | 113 // Called when we receive an ACK for a frame. |
114 virtual void AckFrame(uint32 frame_id, base::TimeTicks when) override { | 114 virtual void AckFrame(uint32 frame_id, base::TimeTicks when) override { |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
334 VLOG(3) << " FBR:" << (bits_per_second / 1E6) | 334 VLOG(3) << " FBR:" << (bits_per_second / 1E6) |
335 << " EBF:" << empty_buffer_fraction | 335 << " EBF:" << empty_buffer_fraction |
336 << " SBR:" << (safe_bitrate / 1E6); | 336 << " SBR:" << (safe_bitrate / 1E6); |
337 bits_per_second = std::max(bits_per_second, min_bitrate_configured_); | 337 bits_per_second = std::max(bits_per_second, min_bitrate_configured_); |
338 bits_per_second = std::min(bits_per_second, max_bitrate_configured_); | 338 bits_per_second = std::min(bits_per_second, max_bitrate_configured_); |
339 return bits_per_second; | 339 return bits_per_second; |
340 } | 340 } |
341 | 341 |
342 } // namespace cast | 342 } // namespace cast |
343 } // namespace media | 343 } // namespace media |
OLD | NEW |