Chore: fix a lot code smell

This commit is contained in:
李通洲
2025-03-25 20:03:09 +08:00
parent bf17f2b4b9
commit 7562e05123
23 changed files with 83 additions and 45 deletions
+5 -3
View File
@@ -48,7 +48,7 @@ const char* ffDetectCamera(FF_MAYBE_UNUSED FFlist* result)
for (uint32_t i = 0; i < count; i++)
{
IMFActivate* device = devices[i];
IMFActivate* FF_AUTO_RELEASE_COM_OBJECT device = devices[i];
wchar_t buffer[256];
uint32_t length = 0;
@@ -90,9 +90,11 @@ const char* ffDetectCamera(FF_MAYBE_UNUSED FFlist* result)
continue;
// Assume first type is the maximum resolution
IMFMediaType* FF_AUTO_RELEASE_COM_OBJECT type = NULL;
IMFMediaType* type = NULL;
for (DWORD idx = 0; SUCCEEDED(handler->GetMediaTypeByIndex(idx, &type)); ++idx)
{
on_scope_exit destroyType([=] { type->Release(); });
GUID majorType;
if (FAILED(type->GetMajorType(&majorType)) || majorType != MFMediaType_Video)
continue;
@@ -123,7 +125,7 @@ const char* ffDetectCamera(FF_MAYBE_UNUSED FFlist* result)
}
}
CoTaskMemFree(devices);
if (devices) CoTaskMemFree(devices);
return nullptr;
}