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