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

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

Issue 2642363003: Make CongestionController::remote_bitrate_estimator_ a non-pointer. (Closed)
Patch Set: Created 3 years, 11 months 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
« no previous file with comments | « webrtc/modules/congestion_controller/congestion_controller.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
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 #include <vector>
15 16
16 #include "webrtc/base/constructormagic.h" 17 #include "webrtc/base/constructormagic.h"
18 #include "webrtc/base/criticalsection.h"
17 #include "webrtc/base/deprecation.h" 19 #include "webrtc/base/deprecation.h"
stefan-webrtc 2017/01/23 10:38:12 Looks like this can be removed, could you do that
nisse-webrtc 2017/01/23 10:47:02 Done.
18 #include "webrtc/common_types.h" 20 #include "webrtc/common_types.h"
19 #include "webrtc/modules/congestion_controller/transport_feedback_adapter.h" 21 #include "webrtc/modules/congestion_controller/transport_feedback_adapter.h"
20 #include "webrtc/modules/include/module.h" 22 #include "webrtc/modules/include/module.h"
21 #include "webrtc/modules/include/module_common_types.h" 23 #include "webrtc/modules/include/module_common_types.h"
22 #include "webrtc/modules/pacing/packet_router.h" 24 #include "webrtc/modules/pacing/packet_router.h"
23 #include "webrtc/modules/pacing/paced_sender.h" 25 #include "webrtc/modules/pacing/paced_sender.h"
24 #include "webrtc/modules/remote_bitrate_estimator/remote_estimator_proxy.h" 26 #include "webrtc/modules/remote_bitrate_estimator/remote_estimator_proxy.h"
25 27
26 namespace rtc { 28 namespace rtc {
27 struct SentPacket; 29 struct SentPacket;
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 virtual void OnSentPacket(const rtc::SentPacket& sent_packet); 112 virtual void OnSentPacket(const rtc::SentPacket& sent_packet);
111 113
112 // Implements CallStatsObserver. 114 // Implements CallStatsObserver.
113 void OnRttUpdate(int64_t avg_rtt_ms, int64_t max_rtt_ms) override; 115 void OnRttUpdate(int64_t avg_rtt_ms, int64_t max_rtt_ms) override;
114 116
115 // Implements Module. 117 // Implements Module.
116 int64_t TimeUntilNextProcess() override; 118 int64_t TimeUntilNextProcess() override;
117 void Process() override; 119 void Process() override;
118 120
119 private: 121 private:
122 class WrappingBitrateEstimator : public RemoteBitrateEstimator {
123 public:
124 WrappingBitrateEstimator(RemoteBitrateObserver* observer, Clock* clock);
125
126 virtual ~WrappingBitrateEstimator() {}
127
128 void IncomingPacket(int64_t arrival_time_ms,
129 size_t payload_size,
130 const RTPHeader& header) override;
131
132 void Process() override;
133
134 int64_t TimeUntilNextProcess() override;
135
136 void OnRttUpdate(int64_t avg_rtt_ms, int64_t max_rtt_ms) override;
137
138 void RemoveStream(unsigned int ssrc) override;
139
140 bool LatestEstimate(std::vector<unsigned int>* ssrcs,
141 unsigned int* bitrate_bps) const override;
142
143 void SetMinBitrate(int min_bitrate_bps) override;
144
145 private:
146 void PickEstimatorFromHeader(const RTPHeader& header)
147 EXCLUSIVE_LOCKS_REQUIRED(crit_sect_);
148 void PickEstimator() EXCLUSIVE_LOCKS_REQUIRED(crit_sect_);
149 RemoteBitrateObserver* observer_;
150 Clock* const clock_;
151 rtc::CriticalSection crit_sect_;
152 std::unique_ptr<RemoteBitrateEstimator> rbe_;
153 bool using_absolute_send_time_;
154 uint32_t packets_since_absolute_send_time_;
155 int min_bitrate_bps_;
156
157 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(WrappingBitrateEstimator);
158 };
159
120 void MaybeTriggerOnNetworkChanged(); 160 void MaybeTriggerOnNetworkChanged();
121 161
122 bool IsSendQueueFull() const; 162 bool IsSendQueueFull() const;
123 bool IsNetworkDown() const; 163 bool IsNetworkDown() const;
124 bool HasNetworkParametersToReportChanged(uint32_t bitrate_bps, 164 bool HasNetworkParametersToReportChanged(uint32_t bitrate_bps,
125 uint8_t fraction_loss, 165 uint8_t fraction_loss,
126 int64_t rtt); 166 int64_t rtt);
127 Clock* const clock_; 167 Clock* const clock_;
128 Observer* const observer_; 168 Observer* const observer_;
129 PacketRouter* const packet_router_; 169 PacketRouter* const packet_router_;
130 const std::unique_ptr<PacedSender> pacer_; 170 const std::unique_ptr<PacedSender> pacer_;
131 const std::unique_ptr<RemoteBitrateEstimator> remote_bitrate_estimator_; 171 WrappingBitrateEstimator remote_bitrate_estimator_;
stefan-webrtc 2017/01/23 10:38:12 Move this down to RemoteEstimatorProxy just to gro
nisse-webrtc 2017/01/23 10:47:01 Done.
132 const std::unique_ptr<BitrateController> bitrate_controller_; 172 const std::unique_ptr<BitrateController> bitrate_controller_;
133 const std::unique_ptr<ProbeController> probe_controller_; 173 const std::unique_ptr<ProbeController> probe_controller_;
134 const std::unique_ptr<RateLimiter> retransmission_rate_limiter_; 174 const std::unique_ptr<RateLimiter> retransmission_rate_limiter_;
135 RemoteEstimatorProxy remote_estimator_proxy_; 175 RemoteEstimatorProxy remote_estimator_proxy_;
136 TransportFeedbackAdapter transport_feedback_adapter_; 176 TransportFeedbackAdapter transport_feedback_adapter_;
137 int min_bitrate_bps_; 177 int min_bitrate_bps_;
138 int max_bitrate_bps_; 178 int max_bitrate_bps_;
139 rtc::CriticalSection critsect_; 179 rtc::CriticalSection critsect_;
140 uint32_t last_reported_bitrate_bps_ GUARDED_BY(critsect_); 180 uint32_t last_reported_bitrate_bps_ GUARDED_BY(critsect_);
141 uint8_t last_reported_fraction_loss_ GUARDED_BY(critsect_); 181 uint8_t last_reported_fraction_loss_ GUARDED_BY(critsect_);
142 int64_t last_reported_rtt_ GUARDED_BY(critsect_); 182 int64_t last_reported_rtt_ GUARDED_BY(critsect_);
143 NetworkState network_state_ GUARDED_BY(critsect_); 183 NetworkState network_state_ GUARDED_BY(critsect_);
144 184
145 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(CongestionController); 185 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(CongestionController);
146 }; 186 };
147 187
148 } // namespace webrtc 188 } // namespace webrtc
149 189
150 #endif // WEBRTC_MODULES_CONGESTION_CONTROLLER_INCLUDE_CONGESTION_CONTROLLER_H_ 190 #endif // WEBRTC_MODULES_CONGESTION_CONTROLLER_INCLUDE_CONGESTION_CONTROLLER_H_
OLDNEW
« no previous file with comments | « webrtc/modules/congestion_controller/congestion_controller.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698