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 #ifndef MEDIA_CAST_CONGESTION_CONTROL_CONGESTION_CONTROL_H_ | 5 #ifndef MEDIA_CAST_CONGESTION_CONTROL_CONGESTION_CONTROL_H_ |
6 #define MEDIA_CAST_CONGESTION_CONTROL_CONGESTION_CONTROL_H_ | 6 #define MEDIA_CAST_CONGESTION_CONTROL_CONGESTION_CONTROL_H_ |
7 | 7 |
8 #include "base/basictypes.h" | |
9 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
10 #include "base/time/tick_clock.h" | 9 #include "base/time/tick_clock.h" |
11 #include "base/time/time.h" | 10 #include "base/time/time.h" |
12 | 11 |
13 namespace media { | 12 namespace media { |
14 namespace cast { | 13 namespace cast { |
15 | 14 |
16 class CongestionControl { | 15 class CongestionControl { |
17 public: | 16 public: |
18 virtual ~CongestionControl(); | 17 virtual ~CongestionControl(); |
19 | 18 |
20 // Called with latest measured rtt value. | 19 // Called with latest measured rtt value. |
21 virtual void UpdateRtt(base::TimeDelta rtt) = 0; | 20 virtual void UpdateRtt(base::TimeDelta rtt) = 0; |
22 | 21 |
23 // Called with an updated target playout delay value. | 22 // Called with an updated target playout delay value. |
24 virtual void UpdateTargetPlayoutDelay(base::TimeDelta delay) = 0; | 23 virtual void UpdateTargetPlayoutDelay(base::TimeDelta delay) = 0; |
25 | 24 |
26 // Called when an encoded frame is enqueued for transport. | 25 // Called when an encoded frame is enqueued for transport. |
27 virtual void SendFrameToTransport(uint32 frame_id, | 26 virtual void SendFrameToTransport(uint32_t frame_id, |
28 size_t frame_size_in_bits, | 27 size_t frame_size_in_bits, |
29 base::TimeTicks when) = 0; | 28 base::TimeTicks when) = 0; |
30 | 29 |
31 // Called when we receive an ACK for a frame. | 30 // Called when we receive an ACK for a frame. |
32 virtual void AckFrame(uint32 frame_id, base::TimeTicks when) = 0; | 31 virtual void AckFrame(uint32_t frame_id, base::TimeTicks when) = 0; |
33 | 32 |
34 // Returns the bitrate we should use for the next frame. |soft_max_bitrate| | 33 // Returns the bitrate we should use for the next frame. |soft_max_bitrate| |
35 // is a soft upper-bound applied to the computed target bitrate before the | 34 // is a soft upper-bound applied to the computed target bitrate before the |
36 // hard upper- and lower-bounds are applied. | 35 // hard upper- and lower-bounds are applied. |
37 virtual int GetBitrate(base::TimeTicks playout_time, | 36 virtual int GetBitrate(base::TimeTicks playout_time, |
38 base::TimeDelta playout_delay, | 37 base::TimeDelta playout_delay, |
39 int soft_max_bitrate) = 0; | 38 int soft_max_bitrate) = 0; |
40 }; | 39 }; |
41 | 40 |
42 CongestionControl* NewAdaptiveCongestionControl( | 41 CongestionControl* NewAdaptiveCongestionControl( |
43 base::TickClock* clock, | 42 base::TickClock* clock, |
44 int max_bitrate_configured, | 43 int max_bitrate_configured, |
45 int min_bitrate_configured, | 44 int min_bitrate_configured, |
46 double max_frame_rate); | 45 double max_frame_rate); |
47 | 46 |
48 CongestionControl* NewFixedCongestionControl(int bitrate); | 47 CongestionControl* NewFixedCongestionControl(int bitrate); |
49 | 48 |
50 } // namespace cast | 49 } // namespace cast |
51 } // namespace media | 50 } // namespace media |
52 | 51 |
53 #endif // MEDIA_CAST_CONGESTION_CONTROL_CONGESTION_CONTROL_H_ | 52 #endif // MEDIA_CAST_CONGESTION_CONTROL_CONGESTION_CONTROL_H_ |
OLD | NEW |