Bug 838799: Protect against funky cameras that return 0 FPS r=derf

This commit is contained in:
Randell Jesup 2013-02-15 02:25:44 -05:00
parent d11b773ac5
commit eec106806d

View File

@ -586,7 +586,8 @@ WebRtc_Word32 DeviceInfoDS::CreateCapabilityMap(
if (hrVC == S_OK)
{
LONGLONG *maxFps; // array
LONGLONG *frameDurationList;
LONGLONG maxFPS;
long listSize;
SIZE size;
size.cx = capability->width;
@ -600,11 +601,13 @@ 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;