OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 * | 9 * |
10 * Usage: this class will register multiple RtcpBitrateObserver's one at each | 10 * Usage: this class will register multiple RtcpBitrateObserver's one at each |
11 * RTCP module. It will aggregate the results and run one bandwidth estimation | 11 * RTCP module. It will aggregate the results and run one bandwidth estimation |
12 * and push the result to the encoders via BitrateObserver(s). | 12 * and push the result to the encoders via BitrateObserver(s). |
13 */ | 13 */ |
14 | 14 |
15 #ifndef WEBRTC_MODULES_BITRATE_CONTROLLER_INCLUDE_BITRATE_CONTROLLER_H_ | 15 #ifndef WEBRTC_MODULES_BITRATE_CONTROLLER_INCLUDE_BITRATE_CONTROLLER_H_ |
16 #define WEBRTC_MODULES_BITRATE_CONTROLLER_INCLUDE_BITRATE_CONTROLLER_H_ | 16 #define WEBRTC_MODULES_BITRATE_CONTROLLER_INCLUDE_BITRATE_CONTROLLER_H_ |
17 | 17 |
| 18 #include <map> |
| 19 |
18 #include "webrtc/modules/congestion_controller/delay_based_bwe.h" | 20 #include "webrtc/modules/congestion_controller/delay_based_bwe.h" |
19 #include "webrtc/modules/include/module.h" | 21 #include "webrtc/modules/include/module.h" |
20 #include "webrtc/modules/pacing/paced_sender.h" | 22 #include "webrtc/modules/pacing/paced_sender.h" |
21 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" | 23 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" |
22 | 24 |
23 namespace webrtc { | 25 namespace webrtc { |
24 | 26 |
25 class RtcEventLog; | 27 class RtcEventLog; |
26 | 28 |
27 // Deprecated | 29 // Deprecated |
28 // TODO(perkj): Remove BitrateObserver when no implementations use it. | 30 // TODO(perkj): Remove BitrateObserver when no implementations use it. |
29 class BitrateObserver { | 31 class BitrateObserver { |
30 // Observer class for bitrate changes announced due to change in bandwidth | 32 // Observer class for bitrate changes announced due to change in bandwidth |
31 // estimate or due to bitrate allocation changes. Fraction loss and rtt is | 33 // estimate or due to bitrate allocation changes. Fraction loss and rtt is |
32 // also part of this callback to allow the obsevrer to optimize its settings | 34 // also part of this callback to allow the obsevrer to optimize its settings |
33 // for different types of network environments. The bitrate does not include | 35 // for different types of network environments. The bitrate does not include |
34 // packet headers and is measured in bits per second. | 36 // packet headers and is measured in bits per second. |
35 public: | 37 public: |
36 virtual void OnNetworkChanged(uint32_t bitrate_bps, | 38 virtual void OnNetworkChanged(uint32_t bitrate_bps, |
37 uint8_t fraction_loss, // 0 - 255. | 39 uint8_t fraction_loss, // 0 - 255. |
38 int64_t rtt_ms) = 0; | 40 int64_t rtt_ms) = 0; |
39 | 41 // TODO(gnish): Merge these two into one function. |
| 42 virtual void OnNetworkChanged(uint32_t bitrate_for_encoder_bps, |
| 43 uint32_t bitrate_for_pacer_bps, |
| 44 bool in_probe_rtt, |
| 45 int64_t target_set_time, |
| 46 uint64_t congestion_window) {} |
| 47 virtual void OnBytesAcked(size_t bytes) {} |
| 48 virtual size_t pacer_queue_size_in_bytes() { return 0; } |
40 virtual ~BitrateObserver() {} | 49 virtual ~BitrateObserver() {} |
41 }; | 50 }; |
42 | 51 |
43 class BitrateController : public Module, | 52 class BitrateController : public Module, public RtcpBandwidthObserver { |
44 public RtcpBandwidthObserver { | |
45 // This class collects feedback from all streams sent to a peer (via | 53 // This class collects feedback from all streams sent to a peer (via |
46 // RTCPBandwidthObservers). It does one aggregated send side bandwidth | 54 // RTCPBandwidthObservers). It does one aggregated send side bandwidth |
47 // estimation and divide the available bitrate between all its registered | 55 // estimation and divide the available bitrate between all its registered |
48 // BitrateObservers. | 56 // BitrateObservers. |
49 public: | 57 public: |
50 static const int kDefaultStartBitratebps = 300000; | 58 static const int kDefaultStartBitratebps = 300000; |
51 | 59 |
52 // Deprecated: | 60 // Deprecated: |
53 // TODO(perkj): BitrateObserver has been deprecated and is not used in WebRTC. | 61 // TODO(perkj): BitrateObserver has been deprecated and is not used in WebRTC. |
54 // Remove this method once other other projects does not use it. | 62 // Remove this method once other other projects does not use it. |
(...skipping 28 matching lines...) Expand all Loading... |
83 virtual bool AvailableBandwidth(uint32_t* bandwidth) const = 0; | 91 virtual bool AvailableBandwidth(uint32_t* bandwidth) const = 0; |
84 | 92 |
85 virtual void SetReservedBitrate(uint32_t reserved_bitrate_bps) = 0; | 93 virtual void SetReservedBitrate(uint32_t reserved_bitrate_bps) = 0; |
86 | 94 |
87 virtual bool GetNetworkParameters(uint32_t* bitrate, | 95 virtual bool GetNetworkParameters(uint32_t* bitrate, |
88 uint8_t* fraction_loss, | 96 uint8_t* fraction_loss, |
89 int64_t* rtt) = 0; | 97 int64_t* rtt) = 0; |
90 }; | 98 }; |
91 } // namespace webrtc | 99 } // namespace webrtc |
92 #endif // WEBRTC_MODULES_BITRATE_CONTROLLER_INCLUDE_BITRATE_CONTROLLER_H_ | 100 #endif // WEBRTC_MODULES_BITRATE_CONTROLLER_INCLUDE_BITRATE_CONTROLLER_H_ |
OLD | NEW |