VCM: Adding the fecMethod as a member of the hybrid NACK/FEC class.

Review URL: http://webrtc-codereview.appspot.com/93002

git-svn-id: http://webrtc.googlecode.com/svn/trunk@247 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
mikhal@google.com
2011-07-22 22:05:25 +00:00
parent 069e63085e
commit 7740888ad6
2 changed files with 22 additions and 13 deletions

View File

@@ -28,6 +28,16 @@ VCMProtectionMethod::UpdateContentMetrics(const
_qmRobustness->UpdateContent(contentMetrics); _qmRobustness->UpdateContent(contentMetrics);
} }
VCMNackFecMethod::VCMNackFecMethod() : VCMProtectionMethod(kNackFec)
{
_fecMethod = new VCMFecMethod();
}
VCMNackFecMethod::~VCMNackFecMethod()
{
delete _fecMethod;
}
bool bool
VCMNackFecMethod::ProtectionFactor(const VCMNackFecMethod::ProtectionFactor(const
VCMProtectionParameters* parameters) VCMProtectionParameters* parameters)
@@ -50,13 +60,11 @@ VCMNackFecMethod::ProtectionFactor(const
// Otherwise: we count on FEC; if the RTT is below a threshold, then we // Otherwise: we count on FEC; if the RTT is below a threshold, then we
// nack the residual, based on a decision made in the JB. // nack the residual, based on a decision made in the JB.
VCMFecMethod fecMethod;
// Compute the protection factors // Compute the protection factors
fecMethod.ProtectionFactor(parameters); _fecMethod->ProtectionFactor(parameters);
_protectionFactorK = fecMethod._protectionFactorK; _protectionFactorK = _fecMethod->_protectionFactorK;
_protectionFactorD = fecMethod._protectionFactorD; _protectionFactorD = _fecMethod->_protectionFactorD;
// When in Hybrid mode, correct FEC rates based on the // When in Hybrid mode, correct FEC rates based on the
// RTT (NACK effectiveness) // RTT (NACK effectiveness)
@@ -88,11 +96,10 @@ VCMNackFecMethod::EffectivePacketLoss(const
} }
// Set the effective packet loss for encoder (based on FEC code). // Set the effective packet loss for encoder (based on FEC code).
VCMFecMethod fecMethod;
// Compute the effective packet loss and residual packet loss due to FEC. // Compute the effective packet loss and residual packet loss due to FEC.
fecMethod.EffectivePacketLoss(parameters); _fecMethod->EffectivePacketLoss(parameters);
_effectivePacketLoss = fecMethod._effectivePacketLoss; _effectivePacketLoss = _fecMethod->_effectivePacketLoss;
_residualPacketLossFec = fecMethod._residualPacketLossFec; _residualPacketLossFec = _fecMethod->_residualPacketLossFec;
return true; return true;
} }
@@ -122,9 +129,8 @@ VCMNackFecMethod::UpdateParameters(const VCMProtectionParameters* parameters)
// protection factor is defined relative to source number of packets so we // protection factor is defined relative to source number of packets so we
// should convert the factor to reduce mismatch between mediaOpt's rate and // should convert the factor to reduce mismatch between mediaOpt's rate and
// the actual one // the actual one
VCMFecMethod fecMethod; _protectionFactorK = _fecMethod->ConvertFECRate(_protectionFactorK);
_protectionFactorK = fecMethod.ConvertFECRate(_protectionFactorK); _protectionFactorD = _fecMethod->ConvertFECRate(_protectionFactorK);
_protectionFactorD = fecMethod.ConvertFECRate(_protectionFactorK);
return true; return true;
} }

View File

@@ -208,12 +208,15 @@ public:
class VCMNackFecMethod : public VCMProtectionMethod class VCMNackFecMethod : public VCMProtectionMethod
{ {
public: public:
VCMNackFecMethod() : VCMProtectionMethod(kNackFec) {} VCMNackFecMethod();
~VCMNackFecMethod();
virtual bool UpdateParameters(const VCMProtectionParameters* parameters); virtual bool UpdateParameters(const VCMProtectionParameters* parameters);
// Get the effective packet loss for ER // Get the effective packet loss for ER
bool EffectivePacketLoss(const VCMProtectionParameters* parameters); bool EffectivePacketLoss(const VCMProtectionParameters* parameters);
// Get the FEC protection factors // Get the FEC protection factors
bool ProtectionFactor(const VCMProtectionParameters* parameters); bool ProtectionFactor(const VCMProtectionParameters* parameters);
private:
VCMFecMethod* _fecMethod;
}; };