crodbro@ found that the previous field trial, which filtered the deltas
in the trendline estimator, can increase the noise caused by varying
packet sizes. Moving the filtering to the DelayBasedBwe class fixes the
issue.
To avoid confusion, we've updated the field trial name, so e.g.
WebRTC-BweIgnoreSmallPacketsFix/small:200bytes,large:200bytes,
fraction_large:0.25,smoothing:0.1/
should be used to enable the feature.
Bug: webrtc:10932
Change-Id: If77e83043c37fff909038405f634e541ce41abb8
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/159711
Commit-Queue: Björn Terelius <terelius@webrtc.org>
Reviewed-by: Sebastian Jansson <srte@webrtc.org>
Reviewed-by: Christoffer Rodbro <crodbro@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29804}
91 lines
2.9 KiB
C++
91 lines
2.9 KiB
C++
/*
|
|
* Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
|
|
*
|
|
* Use of this source code is governed by a BSD-style license
|
|
* that can be found in the LICENSE file in the root of the source
|
|
* tree. An additional intellectual property rights grant can be found
|
|
* in the file PATENTS. All contributing project authors may
|
|
* be found in the AUTHORS file in the root of the source tree.
|
|
*/
|
|
#ifndef MODULES_CONGESTION_CONTROLLER_GOOG_CC_TRENDLINE_ESTIMATOR_H_
|
|
#define MODULES_CONGESTION_CONTROLLER_GOOG_CC_TRENDLINE_ESTIMATOR_H_
|
|
|
|
#include <stddef.h>
|
|
#include <stdint.h>
|
|
|
|
#include <deque>
|
|
#include <memory>
|
|
#include <utility>
|
|
|
|
#include "api/network_state_predictor.h"
|
|
#include "api/transport/webrtc_key_value_config.h"
|
|
#include "modules/congestion_controller/goog_cc/delay_increase_detector_interface.h"
|
|
#include "modules/remote_bitrate_estimator/include/bwe_defines.h"
|
|
#include "rtc_base/constructor_magic.h"
|
|
|
|
namespace webrtc {
|
|
|
|
class TrendlineEstimator : public DelayIncreaseDetectorInterface {
|
|
public:
|
|
TrendlineEstimator(const WebRtcKeyValueConfig* key_value_config,
|
|
NetworkStatePredictor* network_state_predictor);
|
|
|
|
~TrendlineEstimator() override;
|
|
|
|
// Update the estimator with a new sample. The deltas should represent deltas
|
|
// between timestamp groups as defined by the InterArrival class.
|
|
void Update(double recv_delta_ms,
|
|
double send_delta_ms,
|
|
int64_t send_time_ms,
|
|
int64_t arrival_time_ms,
|
|
size_t packet_size,
|
|
bool calculated_deltas) override;
|
|
|
|
void UpdateTrendline(double recv_delta_ms,
|
|
double send_delta_ms,
|
|
int64_t send_time_ms,
|
|
int64_t arrival_time_ms,
|
|
size_t packet_size);
|
|
|
|
BandwidthUsage State() const override;
|
|
|
|
private:
|
|
friend class GoogCcStatePrinter;
|
|
|
|
void Detect(double trend, double ts_delta, int64_t now_ms);
|
|
|
|
void UpdateThreshold(double modified_offset, int64_t now_ms);
|
|
|
|
// Parameters.
|
|
const size_t window_size_;
|
|
const double smoothing_coef_;
|
|
const double threshold_gain_;
|
|
// Used by the existing threshold.
|
|
int num_of_deltas_;
|
|
// Keep the arrival times small by using the change from the first packet.
|
|
int64_t first_arrival_time_ms_;
|
|
// Exponential backoff filtering.
|
|
double accumulated_delay_;
|
|
double smoothed_delay_;
|
|
// Linear least squares regression.
|
|
std::deque<std::pair<double, double>> delay_hist_;
|
|
|
|
const double k_up_;
|
|
const double k_down_;
|
|
double overusing_time_threshold_;
|
|
double threshold_;
|
|
double prev_modified_trend_;
|
|
int64_t last_update_ms_;
|
|
double prev_trend_;
|
|
double time_over_using_;
|
|
int overuse_counter_;
|
|
BandwidthUsage hypothesis_;
|
|
BandwidthUsage hypothesis_predicted_;
|
|
NetworkStatePredictor* network_state_predictor_;
|
|
|
|
RTC_DISALLOW_COPY_AND_ASSIGN(TrendlineEstimator);
|
|
};
|
|
} // namespace webrtc
|
|
|
|
#endif // MODULES_CONGESTION_CONTROLLER_GOOG_CC_TRENDLINE_ESTIMATOR_H_
|