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

Unified Diff: webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_abs_send_time.cc

Issue 1151603008: Make the BWE threshold adaptive. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Improve self-fairness. Created 5 years, 6 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/remote_bitrate_estimator/remote_bitrate_estimator_abs_send_time.cc
diff --git a/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_abs_send_time.cc b/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_abs_send_time.cc
index 5b34cbbd2336d05f7a9721d862345558bbdd1b7d..ff17beb0d206484bf96403df999ad84b0eed2d76 100644
--- a/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_abs_send_time.cc
+++ b/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_abs_send_time.cc
@@ -18,6 +18,7 @@
#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/modules/remote_bitrate_estimator/test/bwe_test_logging.h"
#include "webrtc/modules/remote_bitrate_estimator/remote_rate_control.h"
#include "webrtc/modules/remote_bitrate_estimator/rate_statistics.h"
#include "webrtc/system_wrappers/interface/clock.h"
@@ -189,6 +190,7 @@ class RemoteBitrateEstimatorAbsSendTimeImpl : public RemoteBitrateEstimator {
RateStatistics incoming_bitrate_ GUARDED_BY(crit_sect_.get());
rtc::scoped_ptr<RemoteRateControl> remote_rate_ GUARDED_BY(crit_sect_.get());
int64_t last_process_time_;
+ int64_t last_arrival_time_ms_;
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());
@@ -216,6 +218,7 @@ RemoteBitrateEstimatorAbsSendTimeImpl::RemoteBitrateEstimatorAbsSendTimeImpl(
incoming_bitrate_(1000, 8000),
remote_rate_(RemoteRateControl::Create(control_type, min_bitrate_bps)),
last_process_time_(-1),
+ last_arrival_time_ms_(-1),
process_interval_ms_(kProcessIntervalMs),
total_propagation_delta_ms_(0),
total_probes_received_(0),
@@ -366,11 +369,12 @@ void RemoteBitrateEstimatorAbsSendTimeImpl::IncomingPacketInfo(
int64_t send_time_ms = static_cast<int64_t>(timestamp) * kTimestampToMs;
CriticalSectionScoped cs(crit_sect_.get());
+ last_arrival_time_ms_ = arrival_time_ms;
int64_t now_ms = clock_->TimeInMilliseconds();
// TODO(holmer): SSRCs are only needed for REMB, should be broken out from
// here.
ssrcs_[ssrc] = now_ms;
- incoming_bitrate_.Update(payload_size, now_ms);
+ incoming_bitrate_.Update(payload_size, arrival_time_ms);
const BandwidthUsage prior_state = detector_.State();
if (first_packet_time_ms_ == -1)
@@ -400,22 +404,25 @@ void RemoteBitrateEstimatorAbsSendTimeImpl::IncomingPacketInfo(
ProcessClusters(now_ms);
}
if (!inter_arrival_.get()) {
- inter_arrival_.reset(new InterArrival(
- (kTimestampGroupLengthMs << kInterArrivalShift) / 1000, kTimestampToMs,
- remote_rate_->GetControlType() == kAimdControl));
+ inter_arrival_.reset(
+ new InterArrival((kTimestampGroupLengthMs << kInterArrivalShift) / 1000,
+ kTimestampToMs, true));
}
+ uint32_t incoming_bitrate_bps = incoming_bitrate_.Rate(arrival_time_ms);
if (inter_arrival_->ComputeDeltas(timestamp, arrival_time_ms, payload_size,
&ts_delta, &t_delta, &size_delta)) {
double ts_delta_ms = (1000.0 * ts_delta) / (1 << kInterArrivalShift);
estimator_.Update(t_delta, ts_delta_ms, size_delta, detector_.State());
+ // BWE_TEST_LOGGING_PLOT(1, "delta", now_ms, t_delta - ts_delta_ms);
detector_.Detect(estimator_.offset(), ts_delta_ms,
- estimator_.num_of_deltas(), now_ms);
+ estimator_.num_of_deltas(), arrival_time_ms,
+ incoming_bitrate_bps);
+ // BWE_TEST_LOGGING_PLOT(1, "noise", now_ms, estimator_.var_noise());
UpdateStats(static_cast<int>(t_delta - ts_delta_ms), now_ms);
}
if (detector_.State() == kBwOverusing) {
- unsigned int incoming_bitrate = incoming_bitrate_.Rate(now_ms);
if (prior_state != kBwOverusing ||
- remote_rate_->TimeToReduceFurther(now_ms, incoming_bitrate)) {
+ remote_rate_->TimeToReduceFurther(now_ms, incoming_bitrate_bps)) {
// The first overuse should immediately trigger a new estimate.
// We also have to update the estimate immediately if we are overusing
// and the target bitrate is too high compared to what we are receiving.
@@ -468,15 +475,14 @@ void RemoteBitrateEstimatorAbsSendTimeImpl::UpdateEstimate(int64_t now_ms) {
}
const RateControlInput input(detector_.State(),
- incoming_bitrate_.Rate(now_ms),
+ incoming_bitrate_.Rate(last_arrival_time_ms_),
estimator_.var_noise());
- const RateControlRegion region = remote_rate_->Update(&input, now_ms);
+ remote_rate_->Update(&input, now_ms);
unsigned int target_bitrate = remote_rate_->UpdateBandwidthEstimate(now_ms);
if (remote_rate_->ValidEstimate()) {
process_interval_ms_ = remote_rate_->GetFeedbackInterval();
observer_->OnReceiveBitrateChanged(Keys(ssrcs_), target_bitrate);
}
- detector_.SetRateControlRegion(region);
}
void RemoteBitrateEstimatorAbsSendTimeImpl::OnRttUpdate(int64_t rtt) {

Powered by Google App Engine
This is Rietveld 408576698