Fix for WebRTC Issue 1384. Some cameras return 0 fps for all capabilities which causes divide-by-zero.
Review URL: https://webrtc-codereview.appspot.com/1101013 git-svn-id: http://webrtc.googlecode.com/svn/trunk@3558 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
5140e24037
commit
bf3a9b3cce
@ -570,7 +570,8 @@ WebRtc_Word32 DeviceInfoDS::CreateCapabilityMap(
|
||||
|
||||
if (hrVC == S_OK)
|
||||
{
|
||||
LONGLONG *maxFps; // array
|
||||
LONGLONG *frameDurationList;
|
||||
LONGLONG maxFps;
|
||||
long listSize;
|
||||
SIZE size;
|
||||
size.cx = capability->width;
|
||||
@ -584,11 +585,14 @@ WebRtc_Word32 DeviceInfoDS::CreateCapabilityMap(
|
||||
hrVC = videoControlConfig->GetFrameRateList(outputCapturePin,
|
||||
tmp, size,
|
||||
&listSize,
|
||||
&maxFps);
|
||||
&frameDurationList);
|
||||
|
||||
if (hrVC == S_OK && listSize > 0)
|
||||
// On some odd cameras, you may get a 0 for duration.
|
||||
// GetMaxOfFrameArray returns the lowest duration (highest FPS)
|
||||
if (hrVC == S_OK && listSize > 0 &&
|
||||
0 != (maxFPS = GetMaxOfFrameArray(frameDurationList,
|
||||
listSize)))
|
||||
{
|
||||
LONGLONG maxFPS = GetMaxOfFrameArray(maxFps, listSize);
|
||||
capability->maxFPS = static_cast<int> (10000000
|
||||
/ maxFPS);
|
||||
capability->supportFrameRateControl = true;
|
||||
|
Loading…
x
Reference in New Issue
Block a user