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> | 18 #include <map> |
19 | 19 |
20 #include "webrtc/modules/include/module.h" | 20 #include "webrtc/modules/include/module.h" |
21 #include "webrtc/modules/pacing/paced_sender.h" | 21 #include "webrtc/modules/pacing/paced_sender.h" |
| 22 #include "webrtc/modules/remote_bitrate_estimator/include/remote_bitrate_estimat
or.h" |
22 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" | 23 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" |
23 | 24 |
24 namespace webrtc { | 25 namespace webrtc { |
25 | 26 |
26 class CriticalSectionWrapper; | 27 class CriticalSectionWrapper; |
27 class RtcEventLog; | 28 class RtcEventLog; |
28 struct PacketInfo; | 29 struct PacketInfo; |
29 | 30 |
30 // Deprecated | 31 // Deprecated |
31 // TODO(perkj): Remove BitrateObserver when no implementations use it. | 32 // TODO(perkj): Remove BitrateObserver when no implementations use it. |
32 class BitrateObserver { | 33 class BitrateObserver { |
33 // Observer class for bitrate changes announced due to change in bandwidth | 34 // Observer class for bitrate changes announced due to change in bandwidth |
34 // estimate or due to bitrate allocation changes. Fraction loss and rtt is | 35 // estimate or due to bitrate allocation changes. Fraction loss and rtt is |
35 // also part of this callback to allow the obsevrer to optimize its settings | 36 // also part of this callback to allow the obsevrer to optimize its settings |
36 // for different types of network environments. The bitrate does not include | 37 // for different types of network environments. The bitrate does not include |
37 // packet headers and is measured in bits per second. | 38 // packet headers and is measured in bits per second. |
38 public: | 39 public: |
39 virtual void OnNetworkChanged(uint32_t bitrate_bps, | 40 virtual void OnNetworkChanged(uint32_t bitrate_bps, |
40 uint8_t fraction_loss, // 0 - 255. | 41 uint8_t fraction_loss, // 0 - 255. |
41 int64_t rtt_ms) = 0; | 42 int64_t rtt_ms) = 0; |
42 | 43 |
43 virtual ~BitrateObserver() {} | 44 virtual ~BitrateObserver() {} |
44 }; | 45 }; |
45 | 46 |
46 class BitrateController : public Module { | 47 class BitrateController : public Module, public RemoteBitrateObserver { |
47 // This class collects feedback from all streams sent to a peer (via | 48 // This class collects feedback from all streams sent to a peer (via |
48 // RTCPBandwidthObservers). It does one aggregated send side bandwidth | 49 // RTCPBandwidthObservers). It does one aggregated send side bandwidth |
49 // estimation and divide the available bitrate between all its registered | 50 // estimation and divide the available bitrate between all its registered |
50 // BitrateObservers. | 51 // BitrateObservers. |
51 public: | 52 public: |
52 static const int kDefaultStartBitratebps = 300000; | 53 static const int kDefaultStartBitratebps = 300000; |
53 | 54 |
54 // Deprecated: | 55 // Deprecated: |
55 // TODO(perkj): BitrateObserver has been deprecated and is not used in WebRTC. | 56 // TODO(perkj): BitrateObserver has been deprecated and is not used in WebRTC. |
56 // Remove this method once other other projects does not use it. | 57 // Remove this method once other other projects does not use it. |
(...skipping 13 matching lines...) Expand all Loading... |
70 // Deprecated | 71 // Deprecated |
71 virtual void SetMinMaxBitrate(int min_bitrate_bps, int max_bitrate_bps) = 0; | 72 virtual void SetMinMaxBitrate(int min_bitrate_bps, int max_bitrate_bps) = 0; |
72 virtual void SetBitrates(int start_bitrate_bps, | 73 virtual void SetBitrates(int start_bitrate_bps, |
73 int min_bitrate_bps, | 74 int min_bitrate_bps, |
74 int max_bitrate_bps) = 0; | 75 int max_bitrate_bps) = 0; |
75 | 76 |
76 virtual void ResetBitrates(int bitrate_bps, | 77 virtual void ResetBitrates(int bitrate_bps, |
77 int min_bitrate_bps, | 78 int min_bitrate_bps, |
78 int max_bitrate_bps) = 0; | 79 int max_bitrate_bps) = 0; |
79 | 80 |
80 virtual void UpdateDelayBasedEstimate(uint32_t bitrate_bps) = 0; | |
81 | |
82 virtual void UpdateProbeBitrate(uint32_t bitrate_bps) = 0; | |
83 | |
84 // Gets the available payload bandwidth in bits per second. Note that | 81 // Gets the available payload bandwidth in bits per second. Note that |
85 // this bandwidth excludes packet headers. | 82 // this bandwidth excludes packet headers. |
86 virtual bool AvailableBandwidth(uint32_t* bandwidth) const = 0; | 83 virtual bool AvailableBandwidth(uint32_t* bandwidth) const = 0; |
87 | 84 |
88 virtual void SetReservedBitrate(uint32_t reserved_bitrate_bps) = 0; | 85 virtual void SetReservedBitrate(uint32_t reserved_bitrate_bps) = 0; |
89 | 86 |
90 virtual bool GetNetworkParameters(uint32_t* bitrate, | 87 virtual bool GetNetworkParameters(uint32_t* bitrate, |
91 uint8_t* fraction_loss, | 88 uint8_t* fraction_loss, |
92 int64_t* rtt) = 0; | 89 int64_t* rtt) = 0; |
93 }; | 90 }; |
94 } // namespace webrtc | 91 } // namespace webrtc |
95 #endif // WEBRTC_MODULES_BITRATE_CONTROLLER_INCLUDE_BITRATE_CONTROLLER_H_ | 92 #endif // WEBRTC_MODULES_BITRATE_CONTROLLER_INCLUDE_BITRATE_CONTROLLER_H_ |
OLD | NEW |