media_opt_util: Update robustness settings for Hybrid mode. Updated table for the computation of the adjustment factor.

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

git-svn-id: http://webrtc.googlecode.com/svn/trunk@286 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
mikhal@google.com
2011-08-01 22:14:58 +00:00
parent 5fc2dcd64a
commit 679450f4a6
3 changed files with 125 additions and 227 deletions

View File

@ -43,19 +43,12 @@ VCMNackFecMethod::ProtectionFactor(const
VCMProtectionParameters* parameters) VCMProtectionParameters* parameters)
{ {
// Hybrid Nack FEC has three operational modes: // Hybrid Nack FEC has three operational modes:
// 1. Low RTT - Nack only (Set FEC rates to zero) // 1. Low RTT (below kLowRttNackMs) - Nack only: Set FEC rate
// 2. High RTT - FEC Only // (_protectionFactorD) to zero.
// 3. Medium RTT values - Hybrid ; in hybrid mode, we will only nack the // 2. High RTT (above kHighRttNackMs) - FEC Only: Keep FEC factors.
// residual following the decoding of the FEC (refer to JB logic) // 3. Medium RTT values - Hybrid mode: We will only nack the
// residual following the decoding of the FEC (refer to JB logic). FEC
// Low RTT - NACK only mode // delta protection factor will be adjusted based on the RTT.
if (parameters->rtt < kLowRttNackMs)
{
// Set the FEC parameters to 0
_protectionFactorK = 0;
_protectionFactorD = 0;
return true;
}
// 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.
@ -66,18 +59,22 @@ VCMNackFecMethod::ProtectionFactor(const
_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 (RTT range), adjust FEC rates based on the
// RTT (NACK effectiveness) // RTT (NACK effectiveness) - adjustment factor is in the range [0,1].
if (parameters->rtt < kHighRttNackMs) if (parameters->rtt < kHighRttNackMs)
{ {
WebRtc_UWord16 rttIndex = (WebRtc_UWord16) parameters->rtt; WebRtc_UWord16 rttIndex = (WebRtc_UWord16) parameters->rtt;
// TODO(mikhal): update table float adjustRtt = (float)VCMNackFecTable[rttIndex] / 100.0f;
float softnessRtt = (float)VCMNackFecTable[rttIndex] / (float)4096.0;
// Soften FEC with NACK on (for delta frame only) // Adjust FEC with NACK on (for delta frame only)
// table depends on RTT relative to rttMax (NACK Threshold) // table depends on RTT relative to rttMax (NACK Threshold)
_protectionFactorD *= static_cast<WebRtc_UWord8> (softnessRtt); _protectionFactorD = static_cast<WebRtc_UWord8>
(adjustRtt *
static_cast<float>(_protectionFactorD));
// update FEC rates after applyingadjustment softness parameter
_fecMethod->UpdateProtectionFactorD(_protectionFactorD);
} }
return true; return true;
} }
@ -85,16 +82,6 @@ bool
VCMNackFecMethod::EffectivePacketLoss(const VCMNackFecMethod::EffectivePacketLoss(const
VCMProtectionParameters* parameters) VCMProtectionParameters* parameters)
{ {
// NACK only mode
if (parameters->rtt < kLowRttNackMs)
{
// Effective Packet Loss, NA in current version.
_effectivePacketLoss = 0;
// No FEC applied.
_residualPacketLossFec = parameters->lossPr;
return true;
}
// Set the effective packet loss for encoder (based on FEC code). // Set the effective packet loss for encoder (based on FEC code).
// 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);
@ -180,6 +167,14 @@ VCMFecMethod::ConvertFECRate(WebRtc_UWord8 codeRateRTP) const
(float)(255 - codeRateRTP)))); (float)(255 - codeRateRTP))));
} }
// Update FEC with protectionFactorD
void
VCMFecMethod::UpdateProtectionFactorD(WebRtc_UWord8 protectionFactorD)
{
_protectionFactorD = protectionFactorD;
}
// AvgRecoveryFEC: computes the residual packet loss function. // AvgRecoveryFEC: computes the residual packet loss function.
// This is the average recovery from the FEC, assuming random packet loss model. // This is the average recovery from the FEC, assuming random packet loss model.
// Computed off-line for a range of FEC code parameters and loss rates. // Computed off-line for a range of FEC code parameters and loss rates.

View File

@ -194,6 +194,8 @@ public:
WebRtc_UWord8 ConvertFECRate(WebRtc_UWord8 codeRate) const; WebRtc_UWord8 ConvertFECRate(WebRtc_UWord8 codeRate) const;
// Get the average effective recovery from FEC: for random loss model // Get the average effective recovery from FEC: for random loss model
float AvgRecoveryFEC(const VCMProtectionParameters* parameters) const; float AvgRecoveryFEC(const VCMProtectionParameters* parameters) const;
// Update FEC with protectionFactorD
void UpdateProtectionFactorD(WebRtc_UWord8 protectionFactorD);
}; };

View File

@ -14,210 +14,111 @@
namespace webrtc namespace webrtc
{ {
// Table for softening FEC rate for NACK/FEC protection method // Table for adjusting FEC rate for NACK/FEC protection method
const WebRtc_UWord16 VCMNackFecTable[200] = { // Table values are built as a sigmoid function, ranging from 0 to
// kHighRttNackMs (100), based on the HybridNackTH values defined in
27, // media_opt_util.h.
const WebRtc_UWord16 VCMNackFecTable[100] = {
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
1,
1,
1,
1,
2,
2,
2,
3,
3,
4,
5,
6,
7,
9,
10,
12,
15,
18,
21,
24,
28, 28,
30, 32,
31, 37,
33, 41,
35, 46,
36, 51,
38, 56,
40, 61,
42,
45,
47,
49,
52,
54,
57,
60,
63,
66, 66,
70, 70,
73, 74,
77, 78,
81, 81,
85, 84,
86,
89, 89,
94, 90,
92,
93,
95,
95,
96,
97,
97,
98, 98,
103, 98,
108, 99,
114, 99,
120, 99,
126, 99,
132, 99,
138, 99,
145, 100,
152, 100,
160, 100,
168, 100,
176, 100,
185, 100,
194, 100,
203, 100,
213, 100,
223, 100,
234, 100,
246, 100,
257, 100,
270, 100,
283, 100,
296, 100,
310, 100,
325, 100,
340, 100,
356, 100,
373, 100,
390, 100,
408, 100,
427, 100,
446, 100,
467, 100,
488, 100,
510, 100,
532, 100,
556, 100,
581, 100,
606, 100,
632, 100,
659, 100,
688, 100,
717, 100,
747,
778,
810,
843,
877,
912,
948,
985,
1022,
1061,
1101,
1142,
1183,
1226,
1269,
1314,
1359,
1404,
1451,
1498,
1546,
1594,
1643,
1693,
1743,
1793,
1843,
1894,
1945,
1996,
2048,
2099,
2150,
2201,
2252,
2302,
2352,
2402,
2452,
2501,
2549,
2597,
2644,
2691,
2736,
2781,
2826,
2869,
2912,
2953,
2994,
3034,
3073,
3110,
3147,
3183,
3218,
3252,
3285,
3317,
3348,
3378,
3407,
3436,
3463,
3489,
3514,
3539,
3563,
3585,
3607,
3628,
3649,
3668,
3687,
3705,
3722,
3739,
3755,
3770,
3785,
3799,
3812,
3825,
3838,
3849,
3861,
3872,
3882,
3892,
3901,
3910,
3919,
3927,
3935,
3943,
3950,
3957,
3963,
3969,
3975,
3981,
3987,
3992,
3997,
4001,
4006,
4010,
4014,
4018,
4022,
4025,
4029,
4032,
4035,
4038,
4041,
4043,
4046,
4048,
4050,
4053,
4055,
4057,
4059,
4060,
4062,
4064,
4065,
4067,
}; };