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)
{
// Hybrid Nack FEC has three operational modes:
// 1. Low RTT - Nack only (Set FEC rates to zero)
// 2. High RTT - FEC Only
// 3. Medium RTT values - Hybrid ; in hybrid mode, we will only nack the
// residual following the decoding of the FEC (refer to JB logic)
// Low RTT - NACK only mode
if (parameters->rtt < kLowRttNackMs)
{
// Set the FEC parameters to 0
_protectionFactorK = 0;
_protectionFactorD = 0;
return true;
}
// 1. Low RTT (below kLowRttNackMs) - Nack only: Set FEC rate
// (_protectionFactorD) to zero.
// 2. High RTT (above kHighRttNackMs) - FEC Only: Keep FEC factors.
// 3. Medium RTT values - Hybrid mode: We will only nack the
// residual following the decoding of the FEC (refer to JB logic). FEC
// delta protection factor will be adjusted based on the RTT.
// 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.
@ -66,18 +59,22 @@ VCMNackFecMethod::ProtectionFactor(const
_protectionFactorK = _fecMethod->_protectionFactorK;
_protectionFactorD = _fecMethod->_protectionFactorD;
// When in Hybrid mode, correct FEC rates based on the
// RTT (NACK effectiveness)
// When in Hybrid mode (RTT range), adjust FEC rates based on the
// RTT (NACK effectiveness) - adjustment factor is in the range [0,1].
if (parameters->rtt < kHighRttNackMs)
{
WebRtc_UWord16 rttIndex = (WebRtc_UWord16) parameters->rtt;
// TODO(mikhal): update table
float softnessRtt = (float)VCMNackFecTable[rttIndex] / (float)4096.0;
float adjustRtt = (float)VCMNackFecTable[rttIndex] / 100.0f;
// 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)
_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;
}
@ -85,16 +82,6 @@ bool
VCMNackFecMethod::EffectivePacketLoss(const
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).
// Compute the effective packet loss and residual packet loss due to FEC.
_fecMethod->EffectivePacketLoss(parameters);
@ -180,6 +167,14 @@ VCMFecMethod::ConvertFECRate(WebRtc_UWord8 codeRateRTP) const
(float)(255 - codeRateRTP))));
}
// Update FEC with protectionFactorD
void
VCMFecMethod::UpdateProtectionFactorD(WebRtc_UWord8 protectionFactorD)
{
_protectionFactorD = protectionFactorD;
}
// AvgRecoveryFEC: computes the residual packet loss function.
// 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.

View File

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

View File

@ -14,210 +14,111 @@
namespace webrtc
{
// Table for softening FEC rate for NACK/FEC protection method
const WebRtc_UWord16 VCMNackFecTable[200] = {
27,
// Table for adjusting FEC rate for NACK/FEC protection method
// Table values are built as a sigmoid function, ranging from 0 to
// kHighRttNackMs (100), based on the HybridNackTH values defined in
// 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,
30,
31,
33,
35,
36,
38,
40,
42,
45,
47,
49,
52,
54,
57,
60,
63,
32,
37,
41,
46,
51,
56,
61,
66,
70,
73,
77,
74,
78,
81,
85,
84,
86,
89,
94,
90,
92,
93,
95,
95,
96,
97,
97,
98,
103,
108,
114,
120,
126,
132,
138,
145,
152,
160,
168,
176,
185,
194,
203,
213,
223,
234,
246,
257,
270,
283,
296,
310,
325,
340,
356,
373,
390,
408,
427,
446,
467,
488,
510,
532,
556,
581,
606,
632,
659,
688,
717,
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,
98,
99,
99,
99,
99,
99,
99,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
};