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 = plossMax - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
codeRateDelta = _qmRobustness->AdjustFecFactor(codeRateDelta, bitRate,
|
float adjustFec = _qmRobustness->AdjustFecFactor(codeRateDelta, bitRate,
|
||||||
parameters->frameRate,
|
parameters->frameRate,
|
||||||
parameters->rtt, packetLoss);
|
parameters->rtt, packetLoss);
|
||||||
|
|
||||||
|
codeRateDelta = static_cast<WebRtc_UWord8>(codeRateDelta * adjustFec);
|
||||||
|
|
||||||
// For Key frame:
|
// For Key frame:
|
||||||
// Effectively at a higher rate, so we scale/boost the rate
|
// Effectively at a higher rate, so we scale/boost the rate
|
||||||
@ -474,12 +476,12 @@ VCMFecMethod::ProtectionFactor(const VCMProtectionParameters* parameters)
|
|||||||
_protectionFactorD = codeRateDelta;
|
_protectionFactorD = codeRateDelta;
|
||||||
|
|
||||||
|
|
||||||
// Set the UEP protection on/off for Key and Delta frames
|
// TODO (marpan): Set the UEP protection on/off for Key and Delta frames
|
||||||
_uepKey = _qmRobustness->SetUepProtection(codeRateKey, bitRate,
|
_useUepProtectionK = _qmRobustness->SetUepProtection(codeRateKey, bitRate,
|
||||||
packetLoss, 0);
|
packetLoss, 0);
|
||||||
|
|
||||||
_uepDelta = _qmRobustness->SetUepProtection(codeRateKey, bitRate,
|
_useUepProtectionD = _qmRobustness->SetUepProtection(codeRateKey, bitRate,
|
||||||
packetLoss, 1);
|
packetLoss, 1);
|
||||||
|
|
||||||
// DONE WITH FEC PROTECTION SETTINGS
|
// DONE WITH FEC PROTECTION SETTINGS
|
||||||
return true;
|
return true;
|
||||||
|
@ -99,7 +99,7 @@ public:
|
|||||||
VCMProtectionMethod(VCMProtectionMethodEnum type) : _protectionFactorK(0),
|
VCMProtectionMethod(VCMProtectionMethodEnum type) : _protectionFactorK(0),
|
||||||
_protectionFactorD(0), _residualPacketLoss(0.0), _scaleProtKey(2.0),
|
_protectionFactorD(0), _residualPacketLoss(0.0), _scaleProtKey(2.0),
|
||||||
_maxPayloadSize(1460), _efficiency(0), _score(0), _type(type),
|
_maxPayloadSize(1460), _efficiency(0), _score(0), _type(type),
|
||||||
_uepKey(0), _uepDelta(1)
|
_useUepProtectionK(false), _useUepProtectionD(true)
|
||||||
{_qmRobustness = new VCMQmRobustness();}
|
{_qmRobustness = new VCMQmRobustness();}
|
||||||
virtual ~VCMProtectionMethod() { delete _qmRobustness;}
|
virtual ~VCMProtectionMethod() { delete _qmRobustness;}
|
||||||
|
|
||||||
@ -145,6 +145,16 @@ public:
|
|||||||
// Return value : Required protectionFactor for delta frame
|
// Return value : Required protectionFactor for delta frame
|
||||||
virtual WebRtc_UWord8 RequiredProtectionFactorD() { return _protectionFactorD; }
|
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
|
// Updates content metrics
|
||||||
void UpdateContentMetrics(const VideoContentMetrics* contentMetrics);
|
void UpdateContentMetrics(const VideoContentMetrics* contentMetrics);
|
||||||
|
|
||||||
@ -156,8 +166,8 @@ public:
|
|||||||
WebRtc_Word32 _maxPayloadSize;
|
WebRtc_Word32 _maxPayloadSize;
|
||||||
|
|
||||||
VCMQmRobustness* _qmRobustness;
|
VCMQmRobustness* _qmRobustness;
|
||||||
bool _uepKey;
|
bool _useUepProtectionK;
|
||||||
bool _uepDelta;
|
bool _useUepProtectionD;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
float _efficiency;
|
float _efficiency;
|
||||||
|
@ -734,28 +734,24 @@ VCMQmRobustness::Reset()
|
|||||||
// Adjust the FEC rate based on the content and the network state
|
// Adjust the FEC rate based on the content and the network state
|
||||||
// (packet loss rate, total rate/bandwidth, round trip time).
|
// (packet loss rate, total rate/bandwidth, round trip time).
|
||||||
// Note that packetLoss here is the filtered loss value.
|
// Note that packetLoss here is the filtered loss value.
|
||||||
WebRtc_UWord8
|
float
|
||||||
VCMQmRobustness::AdjustFecFactor(WebRtc_UWord8 codeRateDelta, float totalRate,
|
VCMQmRobustness::AdjustFecFactor(WebRtc_UWord8 codeRateDelta, float totalRate,
|
||||||
float frameRate,WebRtc_UWord32 rttTime,
|
float frameRate,WebRtc_UWord32 rttTime,
|
||||||
WebRtc_UWord8 packetLoss)
|
WebRtc_UWord8 packetLoss)
|
||||||
{
|
{
|
||||||
|
// Default: no adjustment
|
||||||
|
float adjustFec = 1.0f;
|
||||||
|
|
||||||
if (_contentMetrics == NULL)
|
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.
|
// Compute class state of the content.
|
||||||
MotionNFD();
|
MotionNFD();
|
||||||
Spatial();
|
Spatial();
|
||||||
|
|
||||||
// TODO (marpan):
|
// TODO (marpan): Set FEC adjustment factor
|
||||||
// Set FEC adjustment factor
|
|
||||||
|
|
||||||
codeRateDeltaAdjust = static_cast<WebRtc_UWord8>(codeRateDelta * adjustFec);
|
|
||||||
|
|
||||||
// Keep track of previous values of network state:
|
// Keep track of previous values of network state:
|
||||||
// adjustment may be also based on pattern of changes in 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;
|
_prevCodeRateDelta = codeRateDelta;
|
||||||
|
|
||||||
return codeRateDeltaAdjust;
|
return adjustFec;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the UEP (unequal-protection) on/off for the FEC
|
// Set the UEP (unequal-protection) on/off for the FEC
|
||||||
@ -773,13 +770,14 @@ bool
|
|||||||
VCMQmRobustness::SetUepProtection(WebRtc_UWord8 codeRateDelta, float totalRate,
|
VCMQmRobustness::SetUepProtection(WebRtc_UWord8 codeRateDelta, float totalRate,
|
||||||
WebRtc_UWord8 packetLoss, bool frameType)
|
WebRtc_UWord8 packetLoss, bool frameType)
|
||||||
{
|
{
|
||||||
|
// Default:
|
||||||
|
bool uepProtection = true;
|
||||||
|
|
||||||
if (_contentMetrics == NULL)
|
if (_contentMetrics == NULL)
|
||||||
{
|
{
|
||||||
return VCM_OK;
|
return uepProtection;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Default: UEP on
|
|
||||||
bool uepProtection = true;
|
|
||||||
|
|
||||||
return uepProtection;
|
return uepProtection;
|
||||||
}
|
}
|
||||||
|
@ -179,10 +179,11 @@ public:
|
|||||||
|
|
||||||
virtual void Reset();
|
virtual void Reset();
|
||||||
|
|
||||||
// Adjust FEC rate based on content: every ~1 sec from SetTargetRates
|
// Adjust FEC rate based on content: every ~1 sec from SetTargetRates.
|
||||||
WebRtc_UWord8 AdjustFecFactor(WebRtc_UWord8 codeRateDelta, float totalRate,
|
// Returns an adjustment factor.
|
||||||
float frameRate, WebRtc_UWord32 rttTime,
|
float AdjustFecFactor(WebRtc_UWord8 codeRateDelta, float totalRate,
|
||||||
WebRtc_UWord8 packetLoss);
|
float frameRate, WebRtc_UWord32 rttTime,
|
||||||
|
WebRtc_UWord8 packetLoss);
|
||||||
|
|
||||||
// Set the UEP protection on/off
|
// Set the UEP protection on/off
|
||||||
bool SetUepProtection(WebRtc_UWord8 codeRateDelta, float totalRate,
|
bool SetUepProtection(WebRtc_UWord8 codeRateDelta, float totalRate,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user