Index: webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_abs_send_time.h |
diff --git a/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_abs_send_time.h b/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_abs_send_time.h |
index b0103b59eedca5f6b27428bbfc2cc482602296ea..6af4618688847f9e375b06503b9be23f309989a4 100644 |
--- a/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_abs_send_time.h |
+++ b/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_abs_send_time.h |
@@ -16,7 +16,9 @@ |
#include <vector> |
#include "webrtc/base/checks.h" |
+#include "webrtc/base/criticalsection.h" |
#include "webrtc/base/scoped_ptr.h" |
+#include "webrtc/base/thread_checker.h" |
#include "webrtc/modules/remote_bitrate_estimator/aimd_rate_control.h" |
#include "webrtc/modules/remote_bitrate_estimator/include/remote_bitrate_estimator.h" |
#include "webrtc/modules/remote_bitrate_estimator/inter_arrival.h" |
@@ -86,65 +88,54 @@ class RemoteBitrateEstimatorAbsSendTime : public RemoteBitrateEstimator { |
void RemoveStream(uint32_t ssrc) override; |
bool LatestEstimate(std::vector<uint32_t>* ssrcs, |
uint32_t* bitrate_bps) const override; |
- bool GetStats(ReceiveBandwidthEstimatorStats* output) const override; |
void SetMinBitrate(int min_bitrate_bps) override; |
private: |
typedef std::map<uint32_t, int64_t> Ssrcs; |
+ enum class ProbeResult { kBitrateUpdated, kNoUpdate }; |
static bool IsWithinClusterBounds(int send_delta_ms, |
const Cluster& cluster_aggregate); |
static void AddCluster(std::list<Cluster>* clusters, Cluster* cluster); |
- int Id() const; |
- |
void IncomingPacketInfo(int64_t arrival_time_ms, |
uint32_t send_time_24bits, |
size_t payload_size, |
uint32_t ssrc, |
bool was_paced); |
- bool IsProbe(int64_t send_time_ms, int payload_size) const |
- EXCLUSIVE_LOCKS_REQUIRED(crit_sect_.get()); |
- |
- // Triggers a new estimate calculation. |
- void UpdateEstimate(int64_t now_ms) |
- EXCLUSIVE_LOCKS_REQUIRED(crit_sect_.get()); |
- |
- void UpdateStats(int propagation_delta_ms, int64_t now_ms) |
- EXCLUSIVE_LOCKS_REQUIRED(crit_sect_.get()); |
- |
void ComputeClusters(std::list<Cluster>* clusters) const; |
std::list<Cluster>::const_iterator FindBestProbe( |
- const std::list<Cluster>& clusters) const |
- EXCLUSIVE_LOCKS_REQUIRED(crit_sect_.get()); |
+ const std::list<Cluster>& clusters) const; |
- void ProcessClusters(int64_t now_ms) |
- EXCLUSIVE_LOCKS_REQUIRED(crit_sect_.get()); |
+ // Returns true if a probe which changed the estimate was detected. |
+ ProbeResult ProcessClusters(int64_t now_ms) EXCLUSIVE_LOCKS_REQUIRED(&crit_); |
bool IsBitrateImproving(int probe_bitrate_bps) const |
- EXCLUSIVE_LOCKS_REQUIRED(crit_sect_.get()); |
- |
- rtc::scoped_ptr<CriticalSectionWrapper> crit_sect_; |
- RemoteBitrateObserver* observer_ GUARDED_BY(crit_sect_.get()); |
- Clock* clock_; |
- Ssrcs ssrcs_ GUARDED_BY(crit_sect_.get()); |
- rtc::scoped_ptr<InterArrival> inter_arrival_ GUARDED_BY(crit_sect_.get()); |
- OveruseEstimator estimator_ GUARDED_BY(crit_sect_.get()); |
- OveruseDetector detector_ GUARDED_BY(crit_sect_.get()); |
- RateStatistics incoming_bitrate_ GUARDED_BY(crit_sect_.get()); |
- AimdRateControl remote_rate_ GUARDED_BY(crit_sect_.get()); |
- int64_t last_process_time_; |
- std::vector<int> recent_propagation_delta_ms_ GUARDED_BY(crit_sect_.get()); |
- std::vector<int64_t> recent_update_time_ms_ GUARDED_BY(crit_sect_.get()); |
- int64_t process_interval_ms_ GUARDED_BY(crit_sect_.get()); |
- int total_propagation_delta_ms_ GUARDED_BY(crit_sect_.get()); |
- |
+ EXCLUSIVE_LOCKS_REQUIRED(&crit_); |
+ |
+ void TimeoutStreams(int64_t now_ms) EXCLUSIVE_LOCKS_REQUIRED(&crit_); |
+ |
+ rtc::ThreadChecker network_thread_; |
+ RemoteBitrateObserver* const observer_; |
+ rtc::scoped_ptr<InterArrival> inter_arrival_; |
+ OveruseEstimator estimator_; |
+ OveruseDetector detector_; |
+ RateStatistics incoming_bitrate_; |
+ std::vector<int> recent_propagation_delta_ms_; |
+ std::vector<int64_t> recent_update_time_ms_; |
std::list<Probe> probes_; |
size_t total_probes_received_; |
int64_t first_packet_time_ms_; |
+ int64_t last_update_ms_; |
+ |
+ rtc::ThreadChecker process_thread_; |
+ rtc::CriticalSection crit_; |
+ Ssrcs ssrcs_ GUARDED_BY(&crit_); |
+ AimdRateControl remote_rate_ GUARDED_BY(&crit_); |
+ Clock* const clock_; |
RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(RemoteBitrateEstimatorAbsSendTime); |
}; |