VCM: Added condition(s) for setting FEC protection factor to zero at low bitrates.
Review URL: https://webrtc-codereview.appspot.com/494001 git-svn-id: http://webrtc.googlecode.com/svn/trunk@2084 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
63a34f4f29
commit
88ad06b999
@ -141,6 +141,31 @@ int VCMNackFecMethod::MaxFramesFec() const {
|
||||
return _maxFramesFec;
|
||||
}
|
||||
|
||||
bool VCMNackFecMethod::BitRateTooLowForFec(
|
||||
const VCMProtectionParameters* parameters) {
|
||||
// Bitrate below which we turn off FEC, regardless of reported packet loss.
|
||||
// The condition should depend on resolution and content. For now, use
|
||||
// threshold on bytes per frame, with some effect for the frame size.
|
||||
// The condition for turning off FEC is also based on other factors,
|
||||
// such as |_numLayers|, |_maxFramesFec|, and |_rtt|.
|
||||
int estimate_bytes_per_frame = 1000 * BitsPerFrame(parameters) / 8;
|
||||
int max_bytes_per_frame = kMaxBytesPerFrameForFec;
|
||||
int num_pixels = parameters->codecWidth * parameters->codecHeight;
|
||||
if (num_pixels <= 352 * 288) {
|
||||
max_bytes_per_frame = kMaxBytesPerFrameForFecLow;
|
||||
} else if (num_pixels > 640 * 480) {
|
||||
max_bytes_per_frame = kMaxBytesPerFrameForFecHigh;
|
||||
}
|
||||
// TODO (marpan): add condition based on maximum frames used for FEC,
|
||||
// and expand condition based on frame size.
|
||||
if (estimate_bytes_per_frame < max_bytes_per_frame &&
|
||||
parameters->numLayers < 3 &&
|
||||
parameters->rtt < kMaxRttTurnOffFec) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
VCMNackFecMethod::EffectivePacketLoss(const VCMProtectionParameters* parameters)
|
||||
{
|
||||
@ -156,6 +181,10 @@ VCMNackFecMethod::UpdateParameters(const VCMProtectionParameters* parameters)
|
||||
ProtectionFactor(parameters);
|
||||
EffectivePacketLoss(parameters);
|
||||
_maxFramesFec = ComputeMaxFramesFec(parameters);
|
||||
if (BitRateTooLowForFec(parameters)) {
|
||||
_protectionFactorK = 0;
|
||||
_protectionFactorD = 0;
|
||||
}
|
||||
|
||||
// Efficiency computation is based on FEC and NACK
|
||||
|
||||
|
@ -203,6 +203,16 @@ public:
|
||||
|
||||
protected:
|
||||
enum { kUpperLimitFramesFec = 6 };
|
||||
// Thresholds values for the bytes/frame and round trip time, below which we
|
||||
// may turn off FEC, depending on |_numLayers| and |_maxFramesFec|.
|
||||
// Max bytes/frame for VGA, corresponds to ~140k at 25fps.
|
||||
enum { kMaxBytesPerFrameForFec = 700 };
|
||||
// Max bytes/frame for CIF and lower: corresponds to ~80k at 25fps.
|
||||
enum { kMaxBytesPerFrameForFecLow = 400 };
|
||||
// Max bytes/frame for frame size larger than VGA, ~200k at 25fps.
|
||||
enum { kMaxBytesPerFrameForFecHigh = 1000 };
|
||||
// Max round trip time threshold in ms.
|
||||
enum { kMaxRttTurnOffFec = 200 };
|
||||
};
|
||||
|
||||
|
||||
@ -219,7 +229,8 @@ public:
|
||||
bool ProtectionFactor(const VCMProtectionParameters* parameters);
|
||||
// Get the max number of frames the FEC is allowed to be based on.
|
||||
int MaxFramesFec() const;
|
||||
|
||||
// Turn off the FEC based on low bitrate and other factors.
|
||||
bool BitRateTooLowForFec(const VCMProtectionParameters* parameters);
|
||||
private:
|
||||
int ComputeMaxFramesFec(const VCMProtectionParameters* parameters);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user