mirror of
https://github.com/mollyim/webrtc.git
synced 2025-05-17 15:47:53 +01:00

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}
126 lines
4.4 KiB
C++
126 lines
4.4 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_DELAY_BASED_BWE_H_
|
|
#define MODULES_CONGESTION_CONTROLLER_GOOG_CC_DELAY_BASED_BWE_H_
|
|
|
|
#include <stddef.h>
|
|
#include <stdint.h>
|
|
|
|
#include <memory>
|
|
#include <vector>
|
|
|
|
#include "absl/types/optional.h"
|
|
#include "api/network_state_predictor.h"
|
|
#include "api/transport/network_types.h"
|
|
#include "api/transport/webrtc_key_value_config.h"
|
|
#include "modules/congestion_controller/goog_cc/delay_increase_detector_interface.h"
|
|
#include "modules/congestion_controller/goog_cc/probe_bitrate_estimator.h"
|
|
#include "modules/remote_bitrate_estimator/aimd_rate_control.h"
|
|
#include "modules/remote_bitrate_estimator/include/bwe_defines.h"
|
|
#include "modules/remote_bitrate_estimator/inter_arrival.h"
|
|
#include "rtc_base/constructor_magic.h"
|
|
#include "rtc_base/experiments/struct_parameters_parser.h"
|
|
#include "rtc_base/race_checker.h"
|
|
|
|
namespace webrtc {
|
|
class RtcEventLog;
|
|
|
|
struct BweIgnoreSmallPacketsSettings {
|
|
static constexpr char kKey[] = "WebRTC-BweIgnoreSmallPacketsFix";
|
|
|
|
BweIgnoreSmallPacketsSettings() = default;
|
|
explicit BweIgnoreSmallPacketsSettings(
|
|
const WebRtcKeyValueConfig* key_value_config);
|
|
|
|
double smoothing_factor = 0.1;
|
|
double fraction_large = 1.0;
|
|
DataSize large_threshold = DataSize::Zero();
|
|
DataSize small_threshold = DataSize::Zero();
|
|
|
|
std::unique_ptr<StructParametersParser> Parser();
|
|
};
|
|
|
|
class DelayBasedBwe {
|
|
public:
|
|
struct Result {
|
|
Result();
|
|
Result(bool probe, DataRate target_bitrate);
|
|
~Result();
|
|
bool updated;
|
|
bool probe;
|
|
DataRate target_bitrate = DataRate::Zero();
|
|
bool recovered_from_overuse;
|
|
bool backoff_in_alr;
|
|
};
|
|
|
|
explicit DelayBasedBwe(const WebRtcKeyValueConfig* key_value_config,
|
|
RtcEventLog* event_log,
|
|
NetworkStatePredictor* network_state_predictor);
|
|
virtual ~DelayBasedBwe();
|
|
|
|
Result IncomingPacketFeedbackVector(
|
|
const TransportPacketsFeedback& msg,
|
|
absl::optional<DataRate> acked_bitrate,
|
|
absl::optional<DataRate> probe_bitrate,
|
|
absl::optional<NetworkStateEstimate> network_estimate,
|
|
bool in_alr);
|
|
void OnRttUpdate(TimeDelta avg_rtt);
|
|
bool LatestEstimate(std::vector<uint32_t>* ssrcs, DataRate* bitrate) const;
|
|
void SetStartBitrate(DataRate start_bitrate);
|
|
void SetMinBitrate(DataRate min_bitrate);
|
|
TimeDelta GetExpectedBwePeriod() const;
|
|
void SetAlrLimitedBackoffExperiment(bool enabled);
|
|
DataRate TriggerOveruse(Timestamp at_time,
|
|
absl::optional<DataRate> link_capacity);
|
|
DataRate last_estimate() const { return prev_bitrate_; }
|
|
|
|
private:
|
|
friend class GoogCcStatePrinter;
|
|
void IncomingPacketFeedback(const PacketResult& packet_feedback,
|
|
Timestamp at_time);
|
|
Result MaybeUpdateEstimate(
|
|
absl::optional<DataRate> acked_bitrate,
|
|
absl::optional<DataRate> probe_bitrate,
|
|
absl::optional<NetworkStateEstimate> state_estimate,
|
|
bool recovered_from_overuse,
|
|
bool in_alr,
|
|
Timestamp at_time);
|
|
// Updates the current remote rate estimate and returns true if a valid
|
|
// estimate exists.
|
|
bool UpdateEstimate(Timestamp now,
|
|
absl::optional<DataRate> acked_bitrate,
|
|
DataRate* target_bitrate);
|
|
|
|
rtc::RaceChecker network_race_;
|
|
RtcEventLog* const event_log_;
|
|
const WebRtcKeyValueConfig* const key_value_config_;
|
|
|
|
// Filtering out small packets. Intention is to base the detection only
|
|
// on video packets even if we have TWCC sequence numbers for audio.
|
|
BweIgnoreSmallPacketsSettings ignore_small_;
|
|
double fraction_large_packets_;
|
|
|
|
NetworkStatePredictor* network_state_predictor_;
|
|
std::unique_ptr<InterArrival> inter_arrival_;
|
|
std::unique_ptr<DelayIncreaseDetectorInterface> delay_detector_;
|
|
Timestamp last_seen_packet_;
|
|
bool uma_recorded_;
|
|
AimdRateControl rate_control_;
|
|
DataRate prev_bitrate_;
|
|
bool has_once_detected_overuse_;
|
|
BandwidthUsage prev_state_;
|
|
bool alr_limited_backoff_enabled_;
|
|
RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(DelayBasedBwe);
|
|
};
|
|
|
|
} // namespace webrtc
|
|
|
|
#endif // MODULES_CONGESTION_CONTROLLER_GOOG_CC_DELAY_BASED_BWE_H_
|