Remove VCMQmRobustness.

Class contained a lot of not-really-wired-up functionality that ended up
being complicated ways of saying return 1; or return false;. This
removes this dependency that complicates code readability significantly.

BUG=webrtc:5066
R=marpan@google.com, marpan@webrtc.org
TBR=stefan@webrtc.org

Review URL: https://codereview.webrtc.org/1917083003 .

Cr-Commit-Position: refs/heads/master@{#12516}
This commit is contained in:
Peter Boström
2016-04-26 23:54:27 +02:00
parent 55a401e607
commit 7389436979
9 changed files with 9 additions and 135 deletions

View File

@ -34,19 +34,10 @@ VCMProtectionMethod::VCMProtectionMethod()
_protectionFactorD(0),
_scaleProtKey(2.0f),
_maxPayloadSize(1460),
_qmRobustness(new VCMQmRobustness()),
_useUepProtectionK(false),
_useUepProtectionD(true),
_corrFecCost(1.0),
_type(kNone) {}
VCMProtectionMethod::~VCMProtectionMethod() {
delete _qmRobustness;
}
void VCMProtectionMethod::UpdateContentMetrics(
const VideoContentMetrics* contentMetrics) {
_qmRobustness->UpdateContent(contentMetrics);
}
VCMProtectionMethod::~VCMProtectionMethod() {}
VCMNackFecMethod::VCMNackFecMethod(int64_t lowRttNackThresholdMs,
int64_t highRttNackThresholdMs)
@ -333,17 +324,6 @@ bool VCMFecMethod::ProtectionFactor(const VCMProtectionParameters* parameters) {
codeRateDelta = kPacketLossMax - 1;
}
float adjustFec = 1.0f;
// Avoid additional adjustments when layers are active.
// TODO(mikhal/marco): Update adjusmtent based on layer info.
if (parameters->numLayers == 1) {
adjustFec = _qmRobustness->AdjustFecFactor(
codeRateDelta, parameters->bitRate, parameters->frameRate,
parameters->rtt, packetLoss);
}
codeRateDelta = static_cast<uint8_t>(codeRateDelta * adjustFec);
// For Key frame:
// Effectively at a higher rate, so we scale/boost the rate
// The boost factor may depend on several factors: ratio of packet
@ -411,13 +391,6 @@ bool VCMFecMethod::ProtectionFactor(const VCMProtectionParameters* parameters) {
_corrFecCost = 0.0f;
}
// TODO(marpan): Set the UEP protection on/off for Key and Delta frames
_useUepProtectionK = _qmRobustness->SetUepProtection(
codeRateKey, parameters->bitRate, packetLoss, 0);
_useUepProtectionD = _qmRobustness->SetUepProtection(
codeRateDelta, parameters->bitRate, packetLoss, 1);
// DONE WITH FEC PROTECTION SETTINGS
return true;
}

View File

@ -138,9 +138,6 @@ class VCMProtectionMethod {
virtual int MaxFramesFec() const { return 1; }
// Updates content metrics
void UpdateContentMetrics(const VideoContentMetrics* contentMetrics);
protected:
uint8_t _effectivePacketLoss;
uint8_t _protectionFactorK;
@ -149,7 +146,6 @@ class VCMProtectionMethod {
float _scaleProtKey;
int32_t _maxPayloadSize;
VCMQmRobustness* _qmRobustness;
bool _useUepProtectionK;
bool _useUepProtectionD;
float _corrFecCost;

View File

@ -33,13 +33,6 @@ void UpdateProtectionCallback(
// Get the FEC code rate for Delta frames (set to 0 when NA).
delta_fec_params.fec_rate = selected_method->RequiredProtectionFactorD();
// Get the FEC-UEP protection status for Key frames: UEP on/off.
key_fec_params.use_uep_protection = selected_method->RequiredUepProtectionK();
// Get the FEC-UEP protection status for Delta frames: UEP on/off.
delta_fec_params.use_uep_protection =
selected_method->RequiredUepProtectionD();
// The RTP module currently requires the same |max_fec_frames| for both
// key and delta frames.
delta_fec_params.max_fec_frames = selected_method->MaxFramesFec();
@ -229,9 +222,6 @@ uint32_t MediaOptimization::SetTargetRates(
// Update protection settings, when applicable.
float sent_video_rate_kbps = 0.0f;
if (loss_prot_logic_->SelectedType() != kNone) {
// Update protection method with content metrics.
selected_method->UpdateContentMetrics(content_->ShortTermAvgData());
// Update method will compute the robustness settings for the given
// protection method and the overhead cost
// the protection method is set by the user via SetVideoProtection.

View File

@ -898,56 +898,4 @@ void VCMQmResolution::SelectSpatialDirectionMode(float transition_rate) {
}
}
// ROBUSTNESS CLASS
VCMQmRobustness::VCMQmRobustness() {
Reset();
}
VCMQmRobustness::~VCMQmRobustness() {}
void VCMQmRobustness::Reset() {
prev_total_rate_ = 0.0f;
prev_rtt_time_ = 0;
prev_packet_loss_ = 0;
prev_code_rate_delta_ = 0;
ResetQM();
}
// Adjust the FEC rate based on the content and the network state
// (packet loss rate, total rate/bandwidth, round trip time).
// Note that packetLoss here is the filtered loss value.
float VCMQmRobustness::AdjustFecFactor(uint8_t code_rate_delta,
float total_rate,
float framerate,
int64_t rtt_time,
uint8_t packet_loss) {
// Default: no adjustment
float adjust_fec = 1.0f;
if (content_metrics_ == NULL) {
return adjust_fec;
}
// Compute class state of the content.
ComputeMotionNFD();
ComputeSpatial();
// TODO(marpan): Set FEC adjustment factor.
// Keep track of previous values of network state:
// adjustment may be also based on pattern of changes in network state.
prev_total_rate_ = total_rate;
prev_rtt_time_ = rtt_time;
prev_packet_loss_ = packet_loss;
prev_code_rate_delta_ = code_rate_delta;
return adjust_fec;
}
// Set the UEP (unequal-protection across packets) on/off for the FEC.
bool VCMQmRobustness::SetUepProtection(uint8_t code_rate_delta,
float total_rate,
uint8_t packet_loss,
bool frame_type) {
// Default.
return false;
}
} // namespace webrtc

View File

@ -322,35 +322,5 @@ class VCMQmResolution : public VCMQmMethod {
int num_layers_;
};
// Robustness settings class.
class VCMQmRobustness : public VCMQmMethod {
public:
VCMQmRobustness();
~VCMQmRobustness();
virtual void Reset();
// Adjust FEC rate based on content: every ~1 sec from SetTargetRates.
// Returns an adjustment factor.
float AdjustFecFactor(uint8_t code_rate_delta,
float total_rate,
float framerate,
int64_t rtt_time,
uint8_t packet_loss);
// Set the UEP protection on/off.
bool SetUepProtection(uint8_t code_rate_delta,
float total_rate,
uint8_t packet_loss,
bool frame_type);
private:
// Previous state of network parameters.
float prev_total_rate_;
int64_t prev_rtt_time_;
uint8_t prev_packet_loss_;
uint8_t prev_code_rate_delta_;
};
} // namespace webrtc
#endif // WEBRTC_MODULES_VIDEO_CODING_QM_SELECT_H_