Added a correction factor to FEC overhead in media_opt_util.

This is too handle cases of rate-mismatch (at low rates/low packet number) between estimate in mediaOpt and actual FEC generated in RTP.
Review URL: http://webrtc-codereview.appspot.com/93012

git-svn-id: http://webrtc.googlecode.com/svn/trunk@284 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
marpan@google.com 2011-08-01 19:59:57 +00:00
parent f1ed5ad038
commit 191b780741
2 changed files with 26 additions and 4 deletions

View File

@ -114,7 +114,7 @@ VCMNackFecMethod::UpdateParameters(const VCMProtectionParameters* parameters)
// Add FEC cost: ignore I frames for now
float fecRate = static_cast<float> (_protectionFactorD) / 255.0f;
_efficiency = parameters->bitRate * fecRate;
_efficiency = parameters->bitRate * fecRate * _corrFecCost;
// Add NACK cost, when applicable
if (parameters->rtt < kHighRttNackMs)
@ -430,6 +430,27 @@ VCMFecMethod::ProtectionFactor(const VCMProtectionParameters* parameters)
_protectionFactorK = codeRateKey;
_protectionFactorD = codeRateDelta;
// Generally there is a rate mis-match between the FEC cost estimated
// in mediaOpt and the actual FEC cost sent out in RTP module.
// This is more significant at low rates (small # of source packets), where
// the granularity of the FEC decreases. In this case, non-zero protection
// in mediaOpt may generate 0 FEC packets in RTP sender (since actual #FEC
// is based on rounding off protectionFactor on actual source packet number).
// The correction factor (_corrFecCost) attempts to corrects this, at least
// for cases of low rates/low # of packets.
const float estNumFecGen = 0.5f + static_cast<float> (_protectionFactorD *
avgTotPackets / 255.0f);
// Note we reduce cost factor (which will reduce overhead for FEC and
// hybrid method) and not the protectionFactor.
_corrFecCost = 1.0f;
if (estNumFecGen < 1.5f)
{
_corrFecCost = 0.5f;
}
if (estNumFecGen < 1.0f)
{
_corrFecCost = 0.0f;
}
// TODO (marpan): Set the UEP protection on/off for Key and Delta frames
_useUepProtectionK = _qmRobustness->SetUepProtection(codeRateKey, bitRate,
@ -485,7 +506,7 @@ VCMFecMethod::UpdateParameters(const VCMProtectionParameters* parameters)
// in the new tables, the fecRate is defined relative to total number of
// packets (total rate), so overhead cost is:
_efficiency = parameters->bitRate * fecRate;
_efficiency = parameters->bitRate * fecRate * _corrFecCost;
}
else
{

View File

@ -92,8 +92,8 @@ public:
VCMProtectionMethod(VCMProtectionMethodEnum type) : _effectivePacketLoss(0),
_protectionFactorK(0), _protectionFactorD(0),
_residualPacketLossFec(0.0), _scaleProtKey(2.0), _maxPayloadSize(1460),
_useUepProtectionK(false), _useUepProtectionD(true), _efficiency(0),
_type(type)
_useUepProtectionK(false), _useUepProtectionD(true), _corrFecCost(1.0),
_efficiency(0), _type(type)
{_qmRobustness = new VCMQmRobustness();}
virtual ~VCMProtectionMethod() { delete _qmRobustness;}
@ -157,6 +157,7 @@ public:
VCMQmRobustness* _qmRobustness;
bool _useUepProtectionK;
bool _useUepProtectionD;
float _corrFecCost;
protected:
float _efficiency;