Propagate FieldTrialsView through FEC protection method helpers
And thus in those helpers query RateControlSettings field trials via propagated FieldTrialView instead of the via global field trial string Bug: webrtc:42220378 Change-Id: I84f4bf42037d864519c4d2031d25cf909fd5010f Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/350305 Commit-Queue: Philip Eliasson <philipel@webrtc.org> Reviewed-by: Philip Eliasson <philipel@webrtc.org> Auto-Submit: Danil Chapovalov <danilchap@webrtc.org> Cr-Commit-Position: refs/heads/main@{#42286}
This commit is contained in:
parent
a9d7c19011
commit
67ba914249
@ -30,8 +30,7 @@ FecControllerDefault::FecControllerDefault(
|
|||||||
VCMProtectionCallback* protection_callback)
|
VCMProtectionCallback* protection_callback)
|
||||||
: env_(env),
|
: env_(env),
|
||||||
protection_callback_(protection_callback),
|
protection_callback_(protection_callback),
|
||||||
loss_prot_logic_(new media_optimization::VCMLossProtectionLogic(
|
loss_prot_logic_(new media_optimization::VCMLossProtectionLogic(env_)),
|
||||||
env_.clock().TimeInMilliseconds())),
|
|
||||||
max_payload_size_(1460),
|
max_payload_size_(1460),
|
||||||
overhead_threshold_(GetProtectionOverheadRateThreshold()) {}
|
overhead_threshold_(GetProtectionOverheadRateThreshold()) {}
|
||||||
|
|
||||||
|
|||||||
@ -13,13 +13,16 @@
|
|||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
|
#include "api/field_trials_view.h"
|
||||||
#include "modules/video_coding/fec_rate_table.h"
|
#include "modules/video_coding/fec_rate_table.h"
|
||||||
#include "modules/video_coding/internal_defines.h"
|
#include "modules/video_coding/internal_defines.h"
|
||||||
#include "modules/video_coding/utility/simulcast_rate_allocator.h"
|
#include "modules/video_coding/utility/simulcast_rate_allocator.h"
|
||||||
#include "rtc_base/checks.h"
|
#include "rtc_base/checks.h"
|
||||||
#include "rtc_base/experiments/rate_control_settings.h"
|
#include "rtc_base/experiments/rate_control_settings.h"
|
||||||
#include "rtc_base/numerics/safe_conversions.h"
|
#include "rtc_base/numerics/safe_conversions.h"
|
||||||
|
#include "system_wrappers/include/clock.h"
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
// Max value of loss rates in off-line model
|
// Max value of loss rates in off-line model
|
||||||
@ -80,9 +83,10 @@ int VCMProtectionMethod::MaxFramesFec() const {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
VCMNackFecMethod::VCMNackFecMethod(int64_t lowRttNackThresholdMs,
|
VCMNackFecMethod::VCMNackFecMethod(const FieldTrialsView& field_trials,
|
||||||
|
int64_t lowRttNackThresholdMs,
|
||||||
int64_t highRttNackThresholdMs)
|
int64_t highRttNackThresholdMs)
|
||||||
: VCMFecMethod(),
|
: VCMFecMethod(field_trials),
|
||||||
_lowRttNackMs(lowRttNackThresholdMs),
|
_lowRttNackMs(lowRttNackThresholdMs),
|
||||||
_highRttNackMs(highRttNackThresholdMs),
|
_highRttNackMs(highRttNackThresholdMs),
|
||||||
_maxFramesFec(1) {
|
_maxFramesFec(1) {
|
||||||
@ -244,9 +248,8 @@ bool VCMNackMethod::UpdateParameters(
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
VCMFecMethod::VCMFecMethod()
|
VCMFecMethod::VCMFecMethod(const FieldTrialsView& field_trials)
|
||||||
: VCMProtectionMethod(),
|
: rate_control_settings_(field_trials) {
|
||||||
rate_control_settings_(RateControlSettings::ParseFromFieldTrials()) {
|
|
||||||
_type = kFec;
|
_type = kFec;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -489,8 +492,9 @@ bool VCMFecMethod::UpdateParameters(const VCMProtectionParameters* parameters) {
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
VCMLossProtectionLogic::VCMLossProtectionLogic(int64_t nowMs)
|
VCMLossProtectionLogic::VCMLossProtectionLogic(const Environment& env)
|
||||||
: _currentParameters(),
|
: env_(env),
|
||||||
|
_currentParameters(),
|
||||||
_rtt(0),
|
_rtt(0),
|
||||||
_lossPr(0.0f),
|
_lossPr(0.0f),
|
||||||
_bitRate(0.0f),
|
_bitRate(0.0f),
|
||||||
@ -507,7 +511,7 @@ VCMLossProtectionLogic::VCMLossProtectionLogic(int64_t nowMs)
|
|||||||
_codecWidth(704),
|
_codecWidth(704),
|
||||||
_codecHeight(576),
|
_codecHeight(576),
|
||||||
_numLayers(1) {
|
_numLayers(1) {
|
||||||
Reset(nowMs);
|
Reset(env_.clock().CurrentTime().ms());
|
||||||
}
|
}
|
||||||
|
|
||||||
VCMLossProtectionLogic::~VCMLossProtectionLogic() {
|
VCMLossProtectionLogic::~VCMLossProtectionLogic() {
|
||||||
@ -524,10 +528,11 @@ void VCMLossProtectionLogic::SetMethod(
|
|||||||
_selectedMethod.reset(new VCMNackMethod());
|
_selectedMethod.reset(new VCMNackMethod());
|
||||||
break;
|
break;
|
||||||
case kFec:
|
case kFec:
|
||||||
_selectedMethod.reset(new VCMFecMethod());
|
_selectedMethod = std::make_unique<VCMFecMethod>(env_.field_trials());
|
||||||
break;
|
break;
|
||||||
case kNackFec:
|
case kNackFec:
|
||||||
_selectedMethod.reset(new VCMNackFecMethod(kLowRttNackMs, -1));
|
_selectedMethod = std::make_unique<VCMNackFecMethod>(env_.field_trials(),
|
||||||
|
kLowRttNackMs, -1);
|
||||||
break;
|
break;
|
||||||
case kNone:
|
case kNone:
|
||||||
_selectedMethod.reset();
|
_selectedMethod.reset();
|
||||||
|
|||||||
@ -16,6 +16,8 @@
|
|||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
|
#include "api/environment/environment.h"
|
||||||
|
#include "api/field_trials_view.h"
|
||||||
#include "modules/video_coding/internal_defines.h"
|
#include "modules/video_coding/internal_defines.h"
|
||||||
#include "rtc_base/experiments/rate_control_settings.h"
|
#include "rtc_base/experiments/rate_control_settings.h"
|
||||||
#include "rtc_base/numerics/exp_filter.h"
|
#include "rtc_base/numerics/exp_filter.h"
|
||||||
@ -153,7 +155,7 @@ class VCMNackMethod : public VCMProtectionMethod {
|
|||||||
|
|
||||||
class VCMFecMethod : public VCMProtectionMethod {
|
class VCMFecMethod : public VCMProtectionMethod {
|
||||||
public:
|
public:
|
||||||
VCMFecMethod();
|
explicit VCMFecMethod(const FieldTrialsView& field_trials);
|
||||||
~VCMFecMethod() override;
|
~VCMFecMethod() override;
|
||||||
bool UpdateParameters(const VCMProtectionParameters* parameters) override;
|
bool UpdateParameters(const VCMProtectionParameters* parameters) override;
|
||||||
// Get the effective packet loss for ER
|
// Get the effective packet loss for ER
|
||||||
@ -190,7 +192,8 @@ class VCMFecMethod : public VCMProtectionMethod {
|
|||||||
|
|
||||||
class VCMNackFecMethod : public VCMFecMethod {
|
class VCMNackFecMethod : public VCMFecMethod {
|
||||||
public:
|
public:
|
||||||
VCMNackFecMethod(int64_t lowRttNackThresholdMs,
|
VCMNackFecMethod(const FieldTrialsView& field_trials,
|
||||||
|
int64_t lowRttNackThresholdMs,
|
||||||
int64_t highRttNackThresholdMs);
|
int64_t highRttNackThresholdMs);
|
||||||
~VCMNackFecMethod() override;
|
~VCMNackFecMethod() override;
|
||||||
bool UpdateParameters(const VCMProtectionParameters* parameters) override;
|
bool UpdateParameters(const VCMProtectionParameters* parameters) override;
|
||||||
@ -213,7 +216,7 @@ class VCMNackFecMethod : public VCMFecMethod {
|
|||||||
|
|
||||||
class VCMLossProtectionLogic {
|
class VCMLossProtectionLogic {
|
||||||
public:
|
public:
|
||||||
explicit VCMLossProtectionLogic(int64_t nowMs);
|
explicit VCMLossProtectionLogic(const Environment& env);
|
||||||
~VCMLossProtectionLogic();
|
~VCMLossProtectionLogic();
|
||||||
|
|
||||||
// Set the protection method to be used
|
// Set the protection method to be used
|
||||||
@ -322,6 +325,8 @@ class VCMLossProtectionLogic {
|
|||||||
// Sets the available loss protection methods.
|
// Sets the available loss protection methods.
|
||||||
void UpdateMaxLossHistory(uint8_t lossPr255, int64_t now);
|
void UpdateMaxLossHistory(uint8_t lossPr255, int64_t now);
|
||||||
uint8_t MaxFilteredLossPr(int64_t nowMs) const;
|
uint8_t MaxFilteredLossPr(int64_t nowMs) const;
|
||||||
|
|
||||||
|
const Environment env_;
|
||||||
std::unique_ptr<VCMProtectionMethod> _selectedMethod;
|
std::unique_ptr<VCMProtectionMethod> _selectedMethod;
|
||||||
VCMProtectionParameters _currentParameters;
|
VCMProtectionParameters _currentParameters;
|
||||||
int64_t _rtt;
|
int64_t _rtt;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user