diff --git a/src/modules/video_coding/main/source/media_opt_util.cc b/src/modules/video_coding/main/source/media_opt_util.cc index 29224d9a88..da516ba23c 100644 --- a/src/modules/video_coding/main/source/media_opt_util.cc +++ b/src/modules/video_coding/main/source/media_opt_util.cc @@ -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);