mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-28 00:07:19 +00:00
[host] nvfbc: retry on failure to init
@quantum has observed nvfbc under rare circumstances fail to initialize, this adds a retry to the init with a short delay to hopefully recover from this situation.
This commit is contained in:
parent
60ac03ebaf
commit
8619f787b9
@ -316,6 +316,10 @@ static bool nvfbc_init(void)
|
||||
}
|
||||
|
||||
int adapterIndex = option_get_int("nvfbc", "adapterIndex");
|
||||
|
||||
bool created = false;
|
||||
for(int retry = 0; retry < 2; ++retry)
|
||||
{
|
||||
// NOTE: Calling this on hardware that doesn't support NvFBC such as GeForce
|
||||
// causes a substantial performance pentalty even if it fails! As such we only
|
||||
// attempt NvFBC as a last resort, or if configured via the app:capture
|
||||
@ -335,19 +339,27 @@ static bool nvfbc_init(void)
|
||||
&this->maxWidth, &this->maxHeight))
|
||||
{
|
||||
adapterIndex = i;
|
||||
created = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
IDirect3D9_Release(d3d);
|
||||
|
||||
if (adapterIndex < 0)
|
||||
{
|
||||
free(privData);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!NvFBCToSysCreate(adapterIndex, privData, privDataLen, &this->nvfbc, &this->maxWidth, &this->maxHeight))
|
||||
continue;
|
||||
created = true;
|
||||
}
|
||||
|
||||
if (created)
|
||||
break;
|
||||
|
||||
//10ms delay before retry
|
||||
nsleep(10000000);
|
||||
}
|
||||
|
||||
if (!created)
|
||||
{
|
||||
free(privData);
|
||||
return false;
|
||||
|
Loading…
Reference in New Issue
Block a user