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_CALL_CONGESTION_CONTROLLER_H_ | 11 #ifndef WEBRTC_CALL_CONGESTION_CONTROLLER_H_ |
12 #define WEBRTC_CALL_CONGESTION_CONTROLLER_H_ | 12 #define WEBRTC_CALL_CONGESTION_CONTROLLER_H_ |
13 | 13 |
14 #include "webrtc/base/scoped_ptr.h" | 14 #include "webrtc/base/scoped_ptr.h" |
| 15 #include "webrtc/base/thread_checker.h" |
| 16 #include "webrtc/modules/include/module.h" |
| 17 #include "webrtc/modules/include/module_common_types.h" |
| 18 #include "webrtc/modules/pacing/packet_router.h" |
| 19 #include "webrtc/modules/remote_bitrate_estimator/remote_estimator_proxy.h" |
| 20 #include "webrtc/modules/remote_bitrate_estimator/transport_feedback_adapter.h" |
15 #include "webrtc/stream.h" | 21 #include "webrtc/stream.h" |
16 | 22 |
17 namespace rtc { | 23 namespace rtc { |
18 struct SentPacket; | 24 struct SentPacket; |
19 } | 25 } |
20 | 26 |
21 namespace webrtc { | 27 namespace webrtc { |
22 | 28 |
23 class BitrateController; | 29 class BitrateController; |
24 class BitrateObserver; | 30 class BitrateObserver; |
25 class CallStats; | |
26 class Clock; | 31 class Clock; |
27 class PacedSender; | 32 class PacedSender; |
28 class PacketRouter; | |
29 class ProcessThread; | 33 class ProcessThread; |
30 class RemoteBitrateEstimator; | 34 class RemoteBitrateEstimator; |
31 class RemoteBitrateObserver; | 35 class RemoteBitrateObserver; |
32 class RemoteEstimatorProxy; | |
33 class RtpRtcp; | |
34 class TransportFeedbackAdapter; | |
35 class TransportFeedbackObserver; | 36 class TransportFeedbackObserver; |
36 | 37 |
37 class CongestionController { | 38 class CongestionController : public CallStatsObserver, public Module { |
38 public: | 39 public: |
39 CongestionController(Clock* clock, | 40 CongestionController(Clock* clock, |
40 ProcessThread* process_thread, | |
41 CallStats* call_stats, | |
42 BitrateObserver* bitrate_observer, | 41 BitrateObserver* bitrate_observer, |
43 RemoteBitrateObserver* remote_bitrate_observer); | 42 RemoteBitrateObserver* remote_bitrate_observer); |
44 virtual ~CongestionController(); | 43 virtual ~CongestionController(); |
| 44 |
45 virtual void SetBweBitrates(int min_bitrate_bps, | 45 virtual void SetBweBitrates(int min_bitrate_bps, |
46 int start_bitrate_bps, | 46 int start_bitrate_bps, |
47 int max_bitrate_bps); | 47 int max_bitrate_bps); |
48 | |
49 virtual void SignalNetworkState(NetworkState state); | 48 virtual void SignalNetworkState(NetworkState state); |
50 | |
51 virtual BitrateController* GetBitrateController() const; | 49 virtual BitrateController* GetBitrateController() const; |
52 virtual RemoteBitrateEstimator* GetRemoteBitrateEstimator( | 50 virtual RemoteBitrateEstimator* GetRemoteBitrateEstimator( |
53 bool send_side_bwe) const; | 51 bool send_side_bwe); |
54 virtual int64_t GetPacerQueuingDelayMs() const; | 52 virtual int64_t GetPacerQueuingDelayMs() const; |
55 virtual PacedSender* pacer() const { return pacer_.get(); } | 53 virtual PacedSender* pacer() { return pacer_.get(); } |
56 virtual PacketRouter* packet_router() const { return packet_router_.get(); } | 54 virtual PacketRouter* packet_router() { return &packet_router_; } |
57 virtual TransportFeedbackObserver* GetTransportFeedbackObserver(); | 55 virtual TransportFeedbackObserver* GetTransportFeedbackObserver(); |
58 | 56 |
59 virtual void UpdatePacerBitrate(int bitrate_kbps, | 57 virtual void UpdatePacerBitrate(int bitrate_kbps, |
60 int max_bitrate_kbps, | 58 int max_bitrate_kbps, |
61 int min_bitrate_kbps); | 59 int min_bitrate_kbps); |
62 | 60 |
63 virtual void OnSentPacket(const rtc::SentPacket& sent_packet); | 61 virtual void OnSentPacket(const rtc::SentPacket& sent_packet); |
64 | 62 |
| 63 // Implements CallStatsObserver. |
| 64 void OnRttUpdate(int64_t avg_rtt_ms, int64_t max_rtt_ms) override; |
| 65 |
| 66 // Implements Module. |
| 67 int64_t TimeUntilNextProcess() override; |
| 68 int32_t Process() override; |
| 69 |
65 private: | 70 private: |
66 Clock* const clock_; | 71 Clock* const clock_; |
67 rtc::scoped_ptr<PacketRouter> packet_router_; | 72 rtc::ThreadChecker config_thread_checker_; |
68 rtc::scoped_ptr<PacedSender> pacer_; | 73 const rtc::scoped_ptr<PacedSender> pacer_; |
69 rtc::scoped_ptr<RemoteBitrateEstimator> remote_bitrate_estimator_; | 74 const rtc::scoped_ptr<RemoteBitrateEstimator> remote_bitrate_estimator_; |
70 rtc::scoped_ptr<RemoteEstimatorProxy> remote_estimator_proxy_; | 75 const rtc::scoped_ptr<ProcessThread> pacer_thread_; |
71 | 76 const rtc::scoped_ptr<BitrateController> bitrate_controller_; |
72 // Registered at construct time and assumed to outlive this class. | 77 PacketRouter packet_router_; |
73 ProcessThread* const process_thread_; | 78 RemoteEstimatorProxy remote_estimator_proxy_; |
74 CallStats* const call_stats_; | 79 TransportFeedbackAdapter transport_feedback_adapter_; |
75 | |
76 rtc::scoped_ptr<ProcessThread> pacer_thread_; | |
77 | |
78 rtc::scoped_ptr<BitrateController> bitrate_controller_; | |
79 rtc::scoped_ptr<TransportFeedbackAdapter> transport_feedback_adapter_; | |
80 int min_bitrate_bps_; | 80 int min_bitrate_bps_; |
81 | 81 |
82 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(CongestionController); | 82 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(CongestionController); |
83 }; | 83 }; |
84 | 84 |
85 } // namespace webrtc | 85 } // namespace webrtc |
86 | 86 |
87 #endif // WEBRTC_CALL_CONGESTION_CONTROLLER_H_ | 87 #endif // WEBRTC_CALL_CONGESTION_CONTROLLER_H_ |
OLD | NEW |