Fixed assert error in media_opt_util that may have caused index for look-up table to be out of range.

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

git-svn-id: http://webrtc.googlecode.com/svn/trunk@385 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
marpan@google.com 2011-08-16 20:51:04 +00:00
parent 78dc99e2a1
commit 771ca422df

View File

@ -208,9 +208,9 @@ VCMFecMethod::AvgRecoveryFEC(const VCMProtectionParameters* parameters) const
WebRtc_UWord8 sourcePacketsPerFrame = avgTotPackets - fecPacketsPerFrame;
if (fecPacketsPerFrame == 0)
if ( (fecPacketsPerFrame == 0) || (sourcePacketsPerFrame == 0) )
{
// No protection, so average recovery from FEC == 0.
// No protection, or rate too low: so average recovery from FEC == 0.
return 0.0;
}
@ -220,6 +220,12 @@ VCMFecMethod::AvgRecoveryFEC(const VCMProtectionParameters* parameters) const
sourcePacketsPerFrame = codeSize;
}
// Table defined up to codeSizexcodeSize code
if (fecPacketsPerFrame > codeSize)
{
fecPacketsPerFrame = codeSize;
}
// Check: protection factor is maxed at 50%, so this should never happen
assert(sourcePacketsPerFrame >= 1);