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 <vector> | 14 #include "webrtc/base/scoped_ptr.h" |
| 15 #include "webrtc/stream.h" |
15 | 16 |
16 #include "webrtc/base/criticalsection.h" | 17 namespace rtc { |
17 #include "webrtc/base/scoped_ptr.h" | 18 struct SentPacket; |
18 #include "webrtc/base/socket.h" | 19 } |
19 #include "webrtc/stream.h" | |
20 | 20 |
21 namespace webrtc { | 21 namespace webrtc { |
22 | 22 |
23 class BitrateController; | 23 class BitrateController; |
24 class BitrateObserver; | 24 class BitrateObserver; |
25 class CallStats; | 25 class CallStats; |
26 class Config; | 26 class Clock; |
27 class PacedSender; | 27 class PacedSender; |
28 class PacketRouter; | 28 class PacketRouter; |
29 class ProcessThread; | 29 class ProcessThread; |
30 class RemoteBitrateEstimator; | 30 class RemoteBitrateEstimator; |
| 31 class RemoteBitrateObserver; |
31 class RemoteEstimatorProxy; | 32 class RemoteEstimatorProxy; |
32 class RtpRtcp; | 33 class RtpRtcp; |
33 class SendStatisticsProxy; | |
34 class TransportFeedbackAdapter; | 34 class TransportFeedbackAdapter; |
35 class TransportFeedbackObserver; | 35 class TransportFeedbackObserver; |
36 class ViEEncoder; | |
37 class VieRemb; | |
38 | 36 |
39 class CongestionController { | 37 class CongestionController { |
40 public: | 38 public: |
41 CongestionController(ProcessThread* process_thread, CallStats* call_stats, | 39 CongestionController(Clock* clock, |
42 BitrateObserver* bitrate_observer); | 40 ProcessThread* process_thread, |
| 41 CallStats* call_stats, |
| 42 BitrateObserver* bitrate_observer, |
| 43 RemoteBitrateObserver* remote_bitrate_observer); |
43 virtual ~CongestionController(); | 44 virtual ~CongestionController(); |
44 virtual void AddEncoder(ViEEncoder* encoder); | |
45 virtual void RemoveEncoder(ViEEncoder* encoder); | |
46 virtual void SetBweBitrates(int min_bitrate_bps, | 45 virtual void SetBweBitrates(int min_bitrate_bps, |
47 int start_bitrate_bps, | 46 int start_bitrate_bps, |
48 int max_bitrate_bps); | 47 int max_bitrate_bps); |
49 | 48 |
50 virtual void SetChannelRembStatus(bool sender, | |
51 bool receiver, | |
52 RtpRtcp* rtp_module); | |
53 | |
54 virtual void SignalNetworkState(NetworkState state); | 49 virtual void SignalNetworkState(NetworkState state); |
55 | 50 |
56 virtual BitrateController* GetBitrateController() const; | 51 virtual BitrateController* GetBitrateController() const; |
57 virtual RemoteBitrateEstimator* GetRemoteBitrateEstimator( | 52 virtual RemoteBitrateEstimator* GetRemoteBitrateEstimator( |
58 bool send_side_bwe) const; | 53 bool send_side_bwe) const; |
59 virtual int64_t GetPacerQueuingDelayMs() const; | 54 virtual int64_t GetPacerQueuingDelayMs() const; |
60 virtual PacedSender* pacer() const { return pacer_.get(); } | 55 virtual PacedSender* pacer() const { return pacer_.get(); } |
61 virtual PacketRouter* packet_router() const { return packet_router_.get(); } | 56 virtual PacketRouter* packet_router() const { return packet_router_.get(); } |
62 virtual TransportFeedbackObserver* GetTransportFeedbackObserver(); | 57 virtual TransportFeedbackObserver* GetTransportFeedbackObserver(); |
63 | 58 |
64 virtual void UpdatePacerBitrate(int bitrate_kbps, | 59 virtual void UpdatePacerBitrate(int bitrate_kbps, |
65 int max_bitrate_kbps, | 60 int max_bitrate_kbps, |
66 int min_bitrate_kbps); | 61 int min_bitrate_kbps); |
67 | 62 |
68 virtual void OnSentPacket(const rtc::SentPacket& sent_packet); | 63 virtual void OnSentPacket(const rtc::SentPacket& sent_packet); |
69 | 64 |
70 private: | 65 private: |
71 rtc::scoped_ptr<VieRemb> remb_; | 66 Clock* const clock_; |
72 rtc::scoped_ptr<PacketRouter> packet_router_; | 67 rtc::scoped_ptr<PacketRouter> packet_router_; |
73 rtc::scoped_ptr<PacedSender> pacer_; | 68 rtc::scoped_ptr<PacedSender> pacer_; |
74 rtc::scoped_ptr<RemoteBitrateEstimator> remote_bitrate_estimator_; | 69 rtc::scoped_ptr<RemoteBitrateEstimator> remote_bitrate_estimator_; |
75 rtc::scoped_ptr<RemoteEstimatorProxy> remote_estimator_proxy_; | 70 rtc::scoped_ptr<RemoteEstimatorProxy> remote_estimator_proxy_; |
76 | 71 |
77 rtc::CriticalSection encoder_crit_; | |
78 std::vector<ViEEncoder*> encoders_ GUARDED_BY(encoder_crit_); | |
79 | |
80 // Registered at construct time and assumed to outlive this class. | 72 // Registered at construct time and assumed to outlive this class. |
81 ProcessThread* const process_thread_; | 73 ProcessThread* const process_thread_; |
82 CallStats* const call_stats_; | 74 CallStats* const call_stats_; |
83 | 75 |
84 rtc::scoped_ptr<ProcessThread> pacer_thread_; | 76 rtc::scoped_ptr<ProcessThread> pacer_thread_; |
85 | 77 |
86 rtc::scoped_ptr<BitrateController> bitrate_controller_; | 78 rtc::scoped_ptr<BitrateController> bitrate_controller_; |
87 rtc::scoped_ptr<TransportFeedbackAdapter> transport_feedback_adapter_; | 79 rtc::scoped_ptr<TransportFeedbackAdapter> transport_feedback_adapter_; |
88 int min_bitrate_bps_; | 80 int min_bitrate_bps_; |
89 | 81 |
90 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(CongestionController); | 82 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(CongestionController); |
91 }; | 83 }; |
92 | 84 |
93 } // namespace webrtc | 85 } // namespace webrtc |
94 | 86 |
95 #endif // WEBRTC_CALL_CONGESTION_CONTROLLER_H_ | 87 #endif // WEBRTC_CALL_CONGESTION_CONTROLLER_H_ |
OLD | NEW |