Index: webrtc/modules/congestion_controller/delay_based_bwe.h |
diff --git a/webrtc/modules/congestion_controller/delay_based_bwe.h b/webrtc/modules/congestion_controller/delay_based_bwe.h |
index 7e2c8bdc524a37d1dd8d240c3ea90a3c728f1473..3e0a0149a41e1019bd0843a49f5a29de2ca74f39 100644 |
--- a/webrtc/modules/congestion_controller/delay_based_bwe.h |
+++ b/webrtc/modules/congestion_controller/delay_based_bwe.h |
@@ -18,6 +18,7 @@ |
#include "webrtc/base/checks.h" |
#include "webrtc/base/constructormagic.h" |
+#include "webrtc/base/criticalsection.h" |
#include "webrtc/base/rate_statistics.h" |
#include "webrtc/base/thread_checker.h" |
#include "webrtc/modules/congestion_controller/probe_bitrate_estimator.h" |
@@ -26,42 +27,46 @@ |
#include "webrtc/modules/remote_bitrate_estimator/inter_arrival.h" |
#include "webrtc/modules/remote_bitrate_estimator/overuse_detector.h" |
#include "webrtc/modules/remote_bitrate_estimator/overuse_estimator.h" |
+#include "webrtc/system_wrappers/include/critical_section_wrapper.h" |
namespace webrtc { |
-class DelayBasedBwe { |
+class DelayBasedBwe : public RemoteBitrateEstimator { |
public: |
- static const int64_t kStreamTimeOutMs = 2000; |
- |
- struct Result { |
- Result() : updated(false), probe(false), target_bitrate_bps(0) {} |
- Result(bool probe, uint32_t target_bitrate_bps) |
- : updated(true), probe(probe), target_bitrate_bps(target_bitrate_bps) {} |
- bool updated; |
- bool probe; |
- uint32_t target_bitrate_bps; |
- }; |
- |
- explicit DelayBasedBwe(Clock* clock); |
+ DelayBasedBwe(RemoteBitrateObserver* observer, Clock* clock); |
virtual ~DelayBasedBwe() {} |
- Result IncomingPacketFeedbackVector( |
- const std::vector<PacketInfo>& packet_feedback_vector); |
- void OnRttUpdate(int64_t avg_rtt_ms, int64_t max_rtt_ms); |
+ void IncomingPacketFeedbackVector( |
+ const std::vector<PacketInfo>& packet_feedback_vector) override; |
+ void OnRttUpdate(int64_t avg_rtt_ms, int64_t max_rtt_ms) override; |
bool LatestEstimate(std::vector<uint32_t>* ssrcs, |
- uint32_t* bitrate_bps) const; |
- void SetMinBitrate(int min_bitrate_bps); |
+ uint32_t* bitrate_bps) const override; |
+ void SetMinBitrate(int min_bitrate_bps) override; |
+ |
+ // Required by RemoteBitrateEstimator but does nothing. |
+ void Process() override; |
+ // Required by RemoteBitrateEstimator but does nothing. |
+ int64_t TimeUntilNextProcess() override; |
+ // Required by RemoteBitrateEstimator but does nothing. |
+ void RemoveStream(uint32_t ssrc) override; |
+ void IncomingPacket(int64_t arrival_time_ms, |
+ size_t payload_size, |
+ const RTPHeader& header) override { |
+ RTC_NOTREACHED(); |
+ } |
private: |
- Result IncomingPacketInfo(const PacketInfo& info); |
+ void IncomingPacketInfo(const PacketInfo& info); |
// Updates the current remote rate estimate and returns true if a valid |
// estimate exists. |
bool UpdateEstimate(int64_t packet_arrival_time_ms, |
int64_t now_ms, |
- uint32_t* target_bitrate_bps); |
+ uint32_t* target_bitrate_bps) |
+ EXCLUSIVE_LOCKS_REQUIRED(crit_); |
rtc::ThreadChecker network_thread_; |
Clock* const clock_; |
+ RemoteBitrateObserver* const observer_; |
std::unique_ptr<InterArrival> inter_arrival_; |
std::unique_ptr<OveruseEstimator> estimator_; |
OveruseDetector detector_; |
@@ -69,8 +74,10 @@ |
int64_t last_update_ms_; |
int64_t last_seen_packet_ms_; |
bool uma_recorded_; |
- AimdRateControl remote_rate_; |
- ProbeBitrateEstimator probe_bitrate_estimator_; |
+ |
+ rtc::CriticalSection crit_; |
+ AimdRateControl remote_rate_ GUARDED_BY(&crit_); |
+ ProbeBitrateEstimator probe_bitrate_estimator_ GUARDED_BY(&crit_); |
RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(DelayBasedBwe); |
}; |