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 virtual void OnNetworkChanged(uint32_t bitrate_for_encoder_bps, |
terelius
2017/08/18 14:34:03
Add TODO Merge
gnish1
2017/08/18 14:53:50
Done.
| |
42 uint32_t bitrate_for_pacer_bps, | |
43 bool in_probe_rtt, | |
44 int64_t target_set_time, | |
45 uint64_t congestion_window) {} | |
46 virtual void OnBytesAcked(size_t bytes) {} | |
47 virtual size_t pacer_queue_size_in_bytes() { return 0; } | |
40 virtual ~BitrateObserver() {} | 48 virtual ~BitrateObserver() {} |
41 }; | 49 }; |
42 | 50 |
43 class BitrateController : public Module, | 51 class BitrateController : public Module { |
44 public RtcpBandwidthObserver { | |
terelius
2017/08/18 14:34:03
Add back
gnish1
2017/08/18 14:53:50
Done.
| |
45 // This class collects feedback from all streams sent to a peer (via | 52 // This class collects feedback from all streams sent to a peer (via |
46 // RTCPBandwidthObservers). It does one aggregated send side bandwidth | 53 // RTCPBandwidthObservers). It does one aggregated send side bandwidth |
47 // estimation and divide the available bitrate between all its registered | 54 // estimation and divide the available bitrate between all its registered |
48 // BitrateObservers. | 55 // BitrateObservers. |
49 public: | 56 public: |
50 static const int kDefaultStartBitratebps = 300000; | 57 static const int kDefaultStartBitratebps = 300000; |
51 | 58 |
52 // Deprecated: | 59 // Deprecated: |
53 // TODO(perkj): BitrateObserver has been deprecated and is not used in WebRTC. | 60 // TODO(perkj): BitrateObserver has been deprecated and is not used in WebRTC. |
54 // Remove this method once other other projects does not use it. | 61 // Remove this method once other other projects does not use it. |
55 static BitrateController* CreateBitrateController(const Clock* clock, | 62 static BitrateController* CreateBitrateController(const Clock* clock, |
56 BitrateObserver* observer, | 63 BitrateObserver* observer, |
57 RtcEventLog* event_log); | 64 RtcEventLog* event_log); |
58 | 65 |
59 static BitrateController* CreateBitrateController(const Clock* clock, | 66 static BitrateController* CreateBitrateController(const Clock* clock, |
60 RtcEventLog* event_log); | 67 RtcEventLog* event_log); |
61 | 68 |
62 virtual ~BitrateController() {} | 69 virtual ~BitrateController() {} |
63 | 70 |
64 // Creates RtcpBandwidthObserver caller responsible to delete. | |
terelius
2017/08/18 14:34:03
Add back
gnish1
2017/08/18 14:53:50
Done.
| |
65 virtual RtcpBandwidthObserver* CreateRtcpBandwidthObserver() = 0; | 71 virtual RtcpBandwidthObserver* CreateRtcpBandwidthObserver() = 0; |
66 | 72 |
67 // Deprecated | 73 // Deprecated |
68 virtual void SetStartBitrate(int start_bitrate_bps) = 0; | 74 virtual void SetStartBitrate(int start_bitrate_bps) = 0; |
69 // Deprecated | 75 // Deprecated |
70 virtual void SetMinMaxBitrate(int min_bitrate_bps, int max_bitrate_bps) = 0; | 76 virtual void SetMinMaxBitrate(int min_bitrate_bps, int max_bitrate_bps) = 0; |
71 virtual void SetBitrates(int start_bitrate_bps, | 77 virtual void SetBitrates(int start_bitrate_bps, |
72 int min_bitrate_bps, | 78 int min_bitrate_bps, |
73 int max_bitrate_bps) = 0; | 79 int max_bitrate_bps) = 0; |
74 | 80 |
75 virtual void ResetBitrates(int bitrate_bps, | 81 virtual void ResetBitrates(int bitrate_bps, |
76 int min_bitrate_bps, | 82 int min_bitrate_bps, |
77 int max_bitrate_bps) = 0; | 83 int max_bitrate_bps) = 0; |
78 | 84 |
79 virtual void OnDelayBasedBweResult(const DelayBasedBwe::Result& result) = 0; | 85 virtual void OnDelayBasedBweResult(const DelayBasedBwe::Result& result) = 0; |
80 | 86 |
81 // Gets the available payload bandwidth in bits per second. Note that | 87 // Gets the available payload bandwidth in bits per second. Note that |
82 // this bandwidth excludes packet headers. | 88 // this bandwidth excludes packet headers. |
83 virtual bool AvailableBandwidth(uint32_t* bandwidth) const = 0; | 89 virtual bool AvailableBandwidth(uint32_t* bandwidth) const = 0; |
84 | 90 |
85 virtual void SetReservedBitrate(uint32_t reserved_bitrate_bps) = 0; | 91 virtual void SetReservedBitrate(uint32_t reserved_bitrate_bps) = 0; |
86 | 92 |
87 virtual bool GetNetworkParameters(uint32_t* bitrate, | 93 virtual bool GetNetworkParameters(uint32_t* bitrate, |
88 uint8_t* fraction_loss, | 94 uint8_t* fraction_loss, |
89 int64_t* rtt) = 0; | 95 int64_t* rtt) = 0; |
90 }; | 96 }; |
91 } // namespace webrtc | 97 } // namespace webrtc |
92 #endif // WEBRTC_MODULES_BITRATE_CONTROLLER_INCLUDE_BITRATE_CONTROLLER_H_ | 98 #endif // WEBRTC_MODULES_BITRATE_CONTROLLER_INCLUDE_BITRATE_CONTROLLER_H_ |
OLD | NEW |