Prevent division-by-zero in VCMFecMethod.

Clamps frameRate to at least 1.0 to prevent a zero division.

BUG=webrtc:5124
R=stefan@webrtc.org

Review URL: https://codereview.webrtc.org/1642903002 .

Cr-Commit-Position: refs/heads/master@{#11421}
This commit is contained in:
Peter Boström 2016-01-28 23:55:29 +01:00
parent 46eed76207
commit 5e8351b325

View File

@ -434,6 +434,8 @@ int VCMFecMethod::BitsPerFrame(const VCMProtectionParameters* parameters) {
// TODO(mikhal): Update factor following testing.
float adjustmentFactor = 1;
if (frameRate < 1.0f)
frameRate = 1.0f;
// Average bits per frame (units of kbits)
return static_cast<int>(adjustmentFactor * bitRate / frameRate);
}