提交 c18aab29 编写于 作者: J jp9000

obs-ffmpeg: Fix blacklisted adapter check

The quadro P5000 would incorrectly be considered blacklisted because it
used a string search for the P500, which is an earlier quadro variant
that does not have NVENC support.

To fix this, instead of just doing a string search, additionally check
to make sure that there preceding or trailing numbers on the adapter
name.
上级 de66aeab
......@@ -181,11 +181,32 @@ static const wchar_t *blacklisted_adapters[] = {
static const size_t num_blacklisted =
sizeof(blacklisted_adapters) / sizeof(blacklisted_adapters[0]);
static bool is_adapter(const wchar_t *name, const wchar_t *adapter)
{
const wchar_t *find = wstrstri(name, adapter);
if (!find) {
return false;
}
/* check before string for potential numeric mismatch */
if (find > name && iswdigit(find[-1]) && iswdigit(find[0])) {
return false;
}
/* check after string for potential numeric mismatch */
size_t len = wcslen(adapter);
if (iswdigit(find[len - 1]) && iswdigit(find[len])) {
return false;
}
return true;
}
static bool is_blacklisted(const wchar_t *name)
{
for (size_t i = 0; i < num_blacklisted; i++) {
const wchar_t *blacklisted_adapter = blacklisted_adapters[i];
if (wstrstri(name, blacklisted_adapter)) {
if (is_adapter(name, blacklisted_adapter)) {
return true;
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册