refactor: 优化初始化 winrt

This commit is contained in:
Xu Liu 2021-11-09 22:40:01 +08:00
commit 90459fe347
6 changed files with 26 additions and 11 deletions

View file

@ -52,9 +52,6 @@ bool GraphicsCaptureFrameSource::Initialize() {
SIZE frameSize = { LONG(_frameInWnd.right - _frameInWnd.left), LONG(_frameInWnd.bottom - _frameInWnd.top) };
try {
// Windows.Graphics.Capture API 似乎只能运行于 MTA造成诸多麻烦
winrt::init_apartment(winrt::apartment_type::multi_threaded);
if (!winrt::ApiInformation::IsTypePresent(L"Windows.Graphics.Capture.GraphicsCaptureSession")) {
SPDLOG_LOGGER_ERROR(logger, "不存在 GraphicsCaptureSession API");
return false;