Change to return no adjustment (default) if content_metrics=NULL,
and return true (default) for UEP flag if content_metrics=NULL. Also parameter name change and get function for UEP in media_opt_util. Review URL: http://webrtc-codereview.appspot.com/70002 git-svn-id: http://webrtc.googlecode.com/svn/trunk@199 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
75e1239266
commit
59fd0f12e6
@ -424,9 +424,11 @@ VCMFecMethod::ProtectionFactor(const VCMProtectionParameters* parameters)
|
||||
codeRateDelta = plossMax - 1;
|
||||
}
|
||||
|
||||
codeRateDelta = _qmRobustness->AdjustFecFactor(codeRateDelta, bitRate,
|
||||
parameters->frameRate,
|
||||
parameters->rtt, packetLoss);
|
||||
float adjustFec = _qmRobustness->AdjustFecFactor(codeRateDelta, bitRate,
|
||||
parameters->frameRate,
|
||||
parameters->rtt, packetLoss);
|
||||
|
||||
codeRateDelta = static_cast<WebRtc_UWord8>(codeRateDelta * adjustFec);
|
||||
|
||||
// For Key frame:
|
||||
// Effectively at a higher rate, so we scale/boost the rate
|
||||
@ -474,12 +476,12 @@ VCMFecMethod::ProtectionFactor(const VCMProtectionParameters* parameters)
|
||||
_protectionFactorD = codeRateDelta;
|
||||
|
||||
|
||||
// Set the UEP protection on/off for Key and Delta frames
|
||||
_uepKey = _qmRobustness->SetUepProtection(codeRateKey, bitRate,
|
||||
packetLoss, 0);
|
||||
// TODO (marpan): Set the UEP protection on/off for Key and Delta frames
|
||||
_useUepProtectionK = _qmRobustness->SetUepProtection(codeRateKey, bitRate,
|
||||
packetLoss, 0);
|
||||
|
||||
_uepDelta = _qmRobustness->SetUepProtection(codeRateKey, bitRate,
|
||||
packetLoss, 1);
|
||||
_useUepProtectionD = _qmRobustness->SetUepProtection(codeRateKey, bitRate,
|
||||
packetLoss, 1);
|
||||
|
||||
// DONE WITH FEC PROTECTION SETTINGS
|
||||
return true;
|
||||
|
@ -99,7 +99,7 @@ public:
|
||||
VCMProtectionMethod(VCMProtectionMethodEnum type) : _protectionFactorK(0),
|
||||
_protectionFactorD(0), _residualPacketLoss(0.0), _scaleProtKey(2.0),
|
||||
_maxPayloadSize(1460), _efficiency(0), _score(0), _type(type),
|
||||
_uepKey(0), _uepDelta(1)
|
||||
_useUepProtectionK(false), _useUepProtectionD(true)
|
||||
{_qmRobustness = new VCMQmRobustness();}
|
||||
virtual ~VCMProtectionMethod() { delete _qmRobustness;}
|
||||
|
||||
@ -145,6 +145,16 @@ public:
|
||||
// Return value : Required protectionFactor for delta frame
|
||||
virtual WebRtc_UWord8 RequiredProtectionFactorD() { return _protectionFactorD; }
|
||||
|
||||
// Extracts whether the FEC Unequal protection (UEP) is used for Key frame.
|
||||
//
|
||||
// Return value : Required Unequal protection on/off state.
|
||||
virtual WebRtc_UWord8 RequiredUepProtectionK() { return _useUepProtectionK; }
|
||||
|
||||
// Extracts whether the the FEC Unequal protection (UEP) is used for Delta frame.
|
||||
//
|
||||
// Return value : Required Unequal protection on/off state.
|
||||
virtual WebRtc_UWord8 RequiredUepProtectionD() { return _useUepProtectionD; }
|
||||
|
||||
// Updates content metrics
|
||||
void UpdateContentMetrics(const VideoContentMetrics* contentMetrics);
|
||||
|
||||
@ -156,8 +166,8 @@ public:
|
||||
WebRtc_Word32 _maxPayloadSize;
|
||||
|
||||
VCMQmRobustness* _qmRobustness;
|
||||
bool _uepKey;
|
||||
bool _uepDelta;
|
||||
bool _useUepProtectionK;
|
||||
bool _useUepProtectionD;
|
||||
|
||||
protected:
|
||||
float _efficiency;
|
||||
|
@ -734,28 +734,24 @@ VCMQmRobustness::Reset()
|
||||
// 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.
|
||||
WebRtc_UWord8
|
||||
float
|
||||
VCMQmRobustness::AdjustFecFactor(WebRtc_UWord8 codeRateDelta, float totalRate,
|
||||
float frameRate,WebRtc_UWord32 rttTime,
|
||||
WebRtc_UWord8 packetLoss)
|
||||
{
|
||||
// Default: no adjustment
|
||||
float adjustFec = 1.0f;
|
||||
|
||||
if (_contentMetrics == NULL)
|
||||
{
|
||||
return VCM_OK;
|
||||
return adjustFec;
|
||||
}
|
||||
|
||||
// Default: no adjustment
|
||||
WebRtc_UWord8 codeRateDeltaAdjust = codeRateDelta;
|
||||
float adjustFec = 1.0f;
|
||||
|
||||
// Compute class state of the content.
|
||||
MotionNFD();
|
||||
Spatial();
|
||||
|
||||
// TODO (marpan):
|
||||
// Set FEC adjustment factor
|
||||
|
||||
codeRateDeltaAdjust = static_cast<WebRtc_UWord8>(codeRateDelta * adjustFec);
|
||||
// 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
|
||||
@ -765,7 +761,8 @@ VCMQmRobustness::AdjustFecFactor(WebRtc_UWord8 codeRateDelta, float totalRate,
|
||||
|
||||
_prevCodeRateDelta = codeRateDelta;
|
||||
|
||||
return codeRateDeltaAdjust;
|
||||
return adjustFec;
|
||||
|
||||
}
|
||||
|
||||
// Set the UEP (unequal-protection) on/off for the FEC
|
||||
@ -773,13 +770,14 @@ bool
|
||||
VCMQmRobustness::SetUepProtection(WebRtc_UWord8 codeRateDelta, float totalRate,
|
||||
WebRtc_UWord8 packetLoss, bool frameType)
|
||||
{
|
||||
// Default:
|
||||
bool uepProtection = true;
|
||||
|
||||
if (_contentMetrics == NULL)
|
||||
{
|
||||
return VCM_OK;
|
||||
return uepProtection;
|
||||
}
|
||||
|
||||
// Default: UEP on
|
||||
bool uepProtection = true;
|
||||
|
||||
return uepProtection;
|
||||
}
|
||||
|
@ -179,10 +179,11 @@ public:
|
||||
|
||||
virtual void Reset();
|
||||
|
||||
// Adjust FEC rate based on content: every ~1 sec from SetTargetRates
|
||||
WebRtc_UWord8 AdjustFecFactor(WebRtc_UWord8 codeRateDelta, float totalRate,
|
||||
float frameRate, WebRtc_UWord32 rttTime,
|
||||
WebRtc_UWord8 packetLoss);
|
||||
// Adjust FEC rate based on content: every ~1 sec from SetTargetRates.
|
||||
// Returns an adjustment factor.
|
||||
float AdjustFecFactor(WebRtc_UWord8 codeRateDelta, float totalRate,
|
||||
float frameRate, WebRtc_UWord32 rttTime,
|
||||
WebRtc_UWord8 packetLoss);
|
||||
|
||||
// Set the UEP protection on/off
|
||||
bool SetUepProtection(WebRtc_UWord8 codeRateDelta, float totalRate,
|
||||
|
Loading…
x
Reference in New Issue
Block a user