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

Unified Diff: webrtc/modules/congestion_controller/delay_based_bwe.h

Issue 2378103005: Reland: Fix race / crash in OnNetworkRouteChanged(). (Closed)
Patch Set: . Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
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 3e0a0149a41e1019bd0843a49f5a29de2ca74f39..7e2c8bdc524a37d1dd8d240c3ea90a3c728f1473 100644
--- a/webrtc/modules/congestion_controller/delay_based_bwe.h
+++ b/webrtc/modules/congestion_controller/delay_based_bwe.h
@@ -18,7 +18,6 @@
#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"
@@ -27,46 +26,42 @@
#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 : public RemoteBitrateEstimator {
+class DelayBasedBwe {
public:
- DelayBasedBwe(RemoteBitrateObserver* observer, Clock* clock);
+ 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);
virtual ~DelayBasedBwe() {}
- void IncomingPacketFeedbackVector(
- const std::vector<PacketInfo>& packet_feedback_vector) override;
- void OnRttUpdate(int64_t avg_rtt_ms, int64_t max_rtt_ms) override;
+ Result IncomingPacketFeedbackVector(
+ const std::vector<PacketInfo>& packet_feedback_vector);
+ void OnRttUpdate(int64_t avg_rtt_ms, int64_t max_rtt_ms);
bool LatestEstimate(std::vector<uint32_t>* ssrcs,
- 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();
- }
+ uint32_t* bitrate_bps) const;
+ void SetMinBitrate(int min_bitrate_bps);
private:
- void IncomingPacketInfo(const PacketInfo& info);
+ Result 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)
- EXCLUSIVE_LOCKS_REQUIRED(crit_);
+ uint32_t* target_bitrate_bps);
rtc::ThreadChecker network_thread_;
Clock* const clock_;
- RemoteBitrateObserver* const observer_;
std::unique_ptr<InterArrival> inter_arrival_;
std::unique_ptr<OveruseEstimator> estimator_;
OveruseDetector detector_;
@@ -74,10 +69,8 @@ class DelayBasedBwe : public RemoteBitrateEstimator {
int64_t last_update_ms_;
int64_t last_seen_packet_ms_;
bool uma_recorded_;
-
- rtc::CriticalSection crit_;
- AimdRateControl remote_rate_ GUARDED_BY(&crit_);
- ProbeBitrateEstimator probe_bitrate_estimator_ GUARDED_BY(&crit_);
+ AimdRateControl remote_rate_;
+ ProbeBitrateEstimator probe_bitrate_estimator_;
RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(DelayBasedBwe);
};

Powered by Google App Engine
This is Rietveld 408576698