Chromium Code Reviews| 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 | 10 |
| 11 #ifndef WEBRTC_MODULES_CONGESTION_CONTROLLER_INCLUDE_CONGESTION_CONTROLLER_H_ | 11 #ifndef WEBRTC_MODULES_CONGESTION_CONTROLLER_INCLUDE_CONGESTION_CONTROLLER_H_ |
| 12 #define WEBRTC_MODULES_CONGESTION_CONTROLLER_INCLUDE_CONGESTION_CONTROLLER_H_ | 12 #define WEBRTC_MODULES_CONGESTION_CONTROLLER_INCLUDE_CONGESTION_CONTROLLER_H_ |
| 13 | 13 |
| 14 #include <memory> | 14 #include <memory> |
| 15 | 15 |
| 16 #include "webrtc/base/constructormagic.h" | 16 #include "webrtc/base/constructormagic.h" |
| 17 #include "webrtc/base/scoped_ptr.h" | 17 #include "webrtc/base/scoped_ptr.h" |
| 18 #include "webrtc/common_types.h" | 18 #include "webrtc/common_types.h" |
| 19 #include "webrtc/modules/include/module.h" | 19 #include "webrtc/modules/include/module.h" |
| 20 #include "webrtc/modules/include/module_common_types.h" | 20 #include "webrtc/modules/include/module_common_types.h" |
| 21 #include "webrtc/modules/pacing/packet_router.h" | 21 #include "webrtc/modules/pacing/packet_router.h" |
| 22 #include "webrtc/modules/pacing/paced_sender.h" | |
| 22 #include "webrtc/modules/remote_bitrate_estimator/remote_estimator_proxy.h" | 23 #include "webrtc/modules/remote_bitrate_estimator/remote_estimator_proxy.h" |
| 23 #include "webrtc/modules/remote_bitrate_estimator/transport_feedback_adapter.h" | 24 #include "webrtc/modules/remote_bitrate_estimator/transport_feedback_adapter.h" |
| 24 | 25 |
| 25 namespace rtc { | 26 namespace rtc { |
| 26 struct SentPacket; | 27 struct SentPacket; |
| 27 } | 28 } |
| 28 | 29 |
| 29 namespace webrtc { | 30 namespace webrtc { |
| 30 | 31 |
| 31 class BitrateController; | 32 class BitrateController; |
| 32 class BitrateObserver; | 33 class BitrateObserver; |
| 33 class Clock; | 34 class Clock; |
| 34 class PacedSender; | |
| 35 class ProcessThread; | 35 class ProcessThread; |
| 36 class RemoteBitrateEstimator; | 36 class RemoteBitrateEstimator; |
| 37 class RemoteBitrateObserver; | 37 class RemoteBitrateObserver; |
| 38 class TransportFeedbackObserver; | 38 class TransportFeedbackObserver; |
| 39 | 39 |
| 40 class CongestionObserver { | |
|
stefan-webrtc
2016/05/02 12:56:47
Not sure what a good name for this would be... Net
perkj_webrtc
2016/05/02 14:45:35
Keep as is?
Or move to inner class of CongestionC
| |
| 41 // Observer class for bitrate changes announced due to change in bandwidth | |
| 42 // estimate or due to that the send pacer is full. Fraction loss and rtt is | |
| 43 // also part of this callback to allow the obsevrer to optimize its settings | |
| 44 // for different types of network environments. The bitrate does not include | |
| 45 // packet headers and is measured in bits per second. | |
| 46 public: | |
| 47 virtual void OnNetworkChanged(uint32_t bitrate_bps, | |
| 48 uint8_t fraction_loss, // 0 - 255. | |
| 49 int64_t rtt_ms) = 0; | |
| 50 | |
| 51 protected: | |
| 52 virtual ~CongestionObserver() {} | |
| 53 }; | |
| 54 | |
| 40 class CongestionController : public CallStatsObserver, public Module { | 55 class CongestionController : public CallStatsObserver, public Module { |
| 41 public: | 56 public: |
| 42 CongestionController(Clock* clock, | 57 CongestionController(Clock* clock, |
| 43 BitrateObserver* bitrate_observer, | 58 CongestionObserver* observer, |
| 44 RemoteBitrateObserver* remote_bitrate_observer); | 59 RemoteBitrateObserver* remote_bitrate_observer); |
| 60 CongestionController(Clock* clock, | |
| 61 CongestionObserver* observer, | |
| 62 RemoteBitrateObserver* remote_bitrate_observer, | |
| 63 std::unique_ptr<PacketRouter> packet_router, | |
| 64 std::unique_ptr<PacedSender> pacer); | |
| 45 virtual ~CongestionController(); | 65 virtual ~CongestionController(); |
| 46 | 66 |
| 47 virtual void SetBweBitrates(int min_bitrate_bps, | 67 virtual void SetBweBitrates(int min_bitrate_bps, |
| 48 int start_bitrate_bps, | 68 int start_bitrate_bps, |
| 49 int max_bitrate_bps); | 69 int max_bitrate_bps); |
| 50 virtual void SignalNetworkState(NetworkState state); | 70 virtual void SignalNetworkState(NetworkState state); |
| 51 virtual BitrateController* GetBitrateController() const; | 71 virtual BitrateController* GetBitrateController() const; |
| 52 virtual RemoteBitrateEstimator* GetRemoteBitrateEstimator( | 72 virtual RemoteBitrateEstimator* GetRemoteBitrateEstimator( |
| 53 bool send_side_bwe); | 73 bool send_side_bwe); |
| 54 virtual int64_t GetPacerQueuingDelayMs() const; | 74 virtual int64_t GetPacerQueuingDelayMs() const; |
| 55 virtual PacedSender* pacer() { return pacer_.get(); } | 75 virtual PacedSender* pacer() { return pacer_.get(); } |
| 56 virtual PacketRouter* packet_router() { return &packet_router_; } | 76 virtual PacketRouter* packet_router() { return packet_router_.get(); } |
| 57 virtual TransportFeedbackObserver* GetTransportFeedbackObserver(); | 77 virtual TransportFeedbackObserver* GetTransportFeedbackObserver(); |
| 58 | 78 |
| 59 virtual void UpdatePacerBitrate(int bitrate_kbps, | 79 void SetAllocatedSendBitrate(int allocated_bitrate_bps, |
| 60 int max_bitrate_kbps, | 80 int padding_bitrate_bps); |
| 61 int min_bitrate_kbps); | |
| 62 | 81 |
| 63 virtual void OnSentPacket(const rtc::SentPacket& sent_packet); | 82 virtual void OnSentPacket(const rtc::SentPacket& sent_packet); |
| 64 | 83 |
| 65 // Implements CallStatsObserver. | 84 // Implements CallStatsObserver. |
| 66 void OnRttUpdate(int64_t avg_rtt_ms, int64_t max_rtt_ms) override; | 85 void OnRttUpdate(int64_t avg_rtt_ms, int64_t max_rtt_ms) override; |
| 67 | 86 |
| 68 // Implements Module. | 87 // Implements Module. |
| 69 int64_t TimeUntilNextProcess() override; | 88 int64_t TimeUntilNextProcess() override; |
| 70 void Process() override; | 89 void Process() override; |
| 71 | 90 |
| 72 private: | 91 private: |
| 73 Clock* const clock_; | 92 Clock* const clock_; |
| 93 CongestionObserver* const observer_; | |
| 94 const std::unique_ptr<PacketRouter> packet_router_; | |
| 74 const std::unique_ptr<PacedSender> pacer_; | 95 const std::unique_ptr<PacedSender> pacer_; |
| 75 const std::unique_ptr<RemoteBitrateEstimator> remote_bitrate_estimator_; | 96 const std::unique_ptr<RemoteBitrateEstimator> remote_bitrate_estimator_; |
| 76 const std::unique_ptr<BitrateController> bitrate_controller_; | 97 const std::unique_ptr<BitrateController> bitrate_controller_; |
| 77 PacketRouter packet_router_; | |
| 78 RemoteEstimatorProxy remote_estimator_proxy_; | 98 RemoteEstimatorProxy remote_estimator_proxy_; |
| 79 TransportFeedbackAdapter transport_feedback_adapter_; | 99 TransportFeedbackAdapter transport_feedback_adapter_; |
| 80 int min_bitrate_bps_; | 100 int min_bitrate_bps_; |
| 101 bool send_queue_is_full_; | |
| 102 | |
| 103 void Init(); | |
| 104 | |
| 105 void MaybeTriggerOnNetworkChanged(); | |
|
stefan-webrtc
2016/05/02 12:56:47
Methods before members
perkj_webrtc
2016/05/02 14:45:35
Done.
| |
| 81 | 106 |
| 82 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(CongestionController); | 107 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(CongestionController); |
| 83 }; | 108 }; |
| 84 | 109 |
| 85 } // namespace webrtc | 110 } // namespace webrtc |
| 86 | 111 |
| 87 #endif // WEBRTC_MODULES_CONGESTION_CONTROLLER_INCLUDE_CONGESTION_CONTROLLER_H_ | 112 #endif // WEBRTC_MODULES_CONGESTION_CONTROLLER_INCLUDE_CONGESTION_CONTROLLER_H_ |
| OLD | NEW |