Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(159)

Side by Side Diff: webrtc/modules/congestion_controller/include/congestion_controller.h

Issue 2516983004: Move ownership of PacketRouter from CongestionController to Call. (Closed)
Patch Set: Rebased. Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 virtual void OnNetworkChanged(uint32_t bitrate_bps, 49 virtual void OnNetworkChanged(uint32_t bitrate_bps,
50 uint8_t fraction_loss, // 0 - 255. 50 uint8_t fraction_loss, // 0 - 255.
51 int64_t rtt_ms) = 0; 51 int64_t rtt_ms) = 0;
52 52
53 protected: 53 protected:
54 virtual ~Observer() {} 54 virtual ~Observer() {}
55 }; 55 };
56 CongestionController(Clock* clock, 56 CongestionController(Clock* clock,
57 Observer* observer, 57 Observer* observer,
58 RemoteBitrateObserver* remote_bitrate_observer, 58 RemoteBitrateObserver* remote_bitrate_observer,
59 RtcEventLog* event_log);
60 CongestionController(Clock* clock,
61 Observer* observer,
62 RemoteBitrateObserver* remote_bitrate_observer,
63 RtcEventLog* event_log, 59 RtcEventLog* event_log,
64 std::unique_ptr<PacketRouter> packet_router, 60 PacketRouter* packet_router);
61 CongestionController(Clock* clock,
62 Observer* observer,
63 RemoteBitrateObserver* remote_bitrate_observer,
64 RtcEventLog* event_log,
65 PacketRouter* packet_router,
65 std::unique_ptr<PacedSender> pacer); 66 std::unique_ptr<PacedSender> pacer);
66 virtual ~CongestionController(); 67 virtual ~CongestionController();
67 68
68 virtual void SetBweBitrates(int min_bitrate_bps, 69 virtual void SetBweBitrates(int min_bitrate_bps,
69 int start_bitrate_bps, 70 int start_bitrate_bps,
70 int max_bitrate_bps); 71 int max_bitrate_bps);
71 // Resets both the BWE state and the bitrate estimator. Note the first 72 // Resets both the BWE state and the bitrate estimator. Note the first
72 // argument is the bitrate_bps. 73 // argument is the bitrate_bps.
73 virtual void ResetBweAndBitrates(int bitrate_bps, 74 virtual void ResetBweAndBitrates(int bitrate_bps,
74 int min_bitrate_bps, 75 int min_bitrate_bps,
75 int max_bitrate_bps); 76 int max_bitrate_bps);
76 virtual void SignalNetworkState(NetworkState state); 77 virtual void SignalNetworkState(NetworkState state);
77 virtual BitrateController* GetBitrateController() const; 78 virtual BitrateController* GetBitrateController() const;
78 virtual RemoteBitrateEstimator* GetRemoteBitrateEstimator( 79 virtual RemoteBitrateEstimator* GetRemoteBitrateEstimator(
79 bool send_side_bwe); 80 bool send_side_bwe);
80 virtual int64_t GetPacerQueuingDelayMs() const; 81 virtual int64_t GetPacerQueuingDelayMs() const;
81 virtual PacedSender* pacer() { return pacer_.get(); } 82 virtual PacedSender* pacer() { return pacer_.get(); }
82 virtual PacketRouter* packet_router() { return packet_router_.get(); }
83 virtual TransportFeedbackObserver* GetTransportFeedbackObserver(); 83 virtual TransportFeedbackObserver* GetTransportFeedbackObserver();
84 RateLimiter* GetRetransmissionRateLimiter(); 84 RateLimiter* GetRetransmissionRateLimiter();
85 85
86 // SetAllocatedSendBitrateLimits sets bitrates limits imposed by send codec 86 // SetAllocatedSendBitrateLimits sets bitrates limits imposed by send codec
87 // settings. 87 // settings.
88 // |min_send_bitrate_bps| is the total minimum send bitrate required by all 88 // |min_send_bitrate_bps| is the total minimum send bitrate required by all
89 // sending streams. This is the minimum bitrate the PacedSender will use. 89 // sending streams. This is the minimum bitrate the PacedSender will use.
90 // Note that CongestionController::OnNetworkChanged can still be called with 90 // Note that CongestionController::OnNetworkChanged can still be called with
91 // a lower bitrate estimate. 91 // a lower bitrate estimate.
92 // |max_padding_bitrate_bps| is the max bitrate the send streams request for 92 // |max_padding_bitrate_bps| is the max bitrate the send streams request for
93 // padding. This can be higher than the current network estimate and tells 93 // padding. This can be higher than the current network estimate and tells
94 // the PacedSender how much it should max pad unless there is real packets to 94 // the PacedSender how much it should max pad unless there is real packets to
95 // send. 95 // send.
96 void SetAllocatedSendBitrateLimits(int min_send_bitrate_bps, 96 void SetAllocatedSendBitrateLimits(int min_send_bitrate_bps,
97 int max_padding_bitrate_bps); 97 int max_padding_bitrate_bps);
98 98
99 virtual void OnSentPacket(const rtc::SentPacket& sent_packet); 99 virtual void OnSentPacket(const rtc::SentPacket& sent_packet);
100 100
101 // Implements CallStatsObserver. 101 // Implements CallStatsObserver.
102 void OnRttUpdate(int64_t avg_rtt_ms, int64_t max_rtt_ms) override; 102 void OnRttUpdate(int64_t avg_rtt_ms, int64_t max_rtt_ms) override;
103 103
104 // Implements Module. 104 // Implements Module.
105 int64_t TimeUntilNextProcess() override; 105 int64_t TimeUntilNextProcess() override;
106 void Process() override; 106 void Process() override;
107 107
108 private: 108 private:
109 void Init();
110 void MaybeTriggerOnNetworkChanged(); 109 void MaybeTriggerOnNetworkChanged();
111 110
112 bool IsSendQueueFull() const; 111 bool IsSendQueueFull() const;
113 bool IsNetworkDown() const; 112 bool IsNetworkDown() const;
114 bool HasNetworkParametersToReportChanged(uint32_t bitrate_bps, 113 bool HasNetworkParametersToReportChanged(uint32_t bitrate_bps,
115 uint8_t fraction_loss, 114 uint8_t fraction_loss,
116 int64_t rtt); 115 int64_t rtt);
117 Clock* const clock_; 116 Clock* const clock_;
118 Observer* const observer_; 117 Observer* const observer_;
119 const std::unique_ptr<PacketRouter> packet_router_; 118 PacketRouter* const packet_router_;
120 const std::unique_ptr<PacedSender> pacer_; 119 const std::unique_ptr<PacedSender> pacer_;
121 const std::unique_ptr<RemoteBitrateEstimator> remote_bitrate_estimator_; 120 const std::unique_ptr<RemoteBitrateEstimator> remote_bitrate_estimator_;
122 const std::unique_ptr<BitrateController> bitrate_controller_; 121 const std::unique_ptr<BitrateController> bitrate_controller_;
123 const std::unique_ptr<ProbeController> probe_controller_; 122 const std::unique_ptr<ProbeController> probe_controller_;
124 const std::unique_ptr<RateLimiter> retransmission_rate_limiter_; 123 const std::unique_ptr<RateLimiter> retransmission_rate_limiter_;
125 RemoteEstimatorProxy remote_estimator_proxy_; 124 RemoteEstimatorProxy remote_estimator_proxy_;
126 TransportFeedbackAdapter transport_feedback_adapter_; 125 TransportFeedbackAdapter transport_feedback_adapter_;
127 int min_bitrate_bps_; 126 int min_bitrate_bps_;
128 int max_bitrate_bps_; 127 int max_bitrate_bps_;
129 rtc::CriticalSection critsect_; 128 rtc::CriticalSection critsect_;
130 uint32_t last_reported_bitrate_bps_ GUARDED_BY(critsect_); 129 uint32_t last_reported_bitrate_bps_ GUARDED_BY(critsect_);
131 uint8_t last_reported_fraction_loss_ GUARDED_BY(critsect_); 130 uint8_t last_reported_fraction_loss_ GUARDED_BY(critsect_);
132 int64_t last_reported_rtt_ GUARDED_BY(critsect_); 131 int64_t last_reported_rtt_ GUARDED_BY(critsect_);
133 NetworkState network_state_ GUARDED_BY(critsect_); 132 NetworkState network_state_ GUARDED_BY(critsect_);
134 133
135 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(CongestionController); 134 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(CongestionController);
136 }; 135 };
137 136
138 } // namespace webrtc 137 } // namespace webrtc
139 138
140 #endif // WEBRTC_MODULES_CONGESTION_CONTROLLER_INCLUDE_CONGESTION_CONTROLLER_H_ 139 #endif // WEBRTC_MODULES_CONGESTION_CONTROLLER_INCLUDE_CONGESTION_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698