Skip to content

Commit 868b613

Browse files
committed
Use CreateFreeThreaded instead of Create in SimpleCapture
1 parent 2a51573 commit 868b613

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

Win32CaptureSample/SimpleCapture.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,12 @@ SimpleCapture::SimpleCapture(
3636
m_swapChain = util::CreateDXGISwapChain(m_d3dDevice, static_cast<uint32_t>(m_item.Size().Width), static_cast<uint32_t>(m_item.Size().Height),
3737
static_cast<DXGI_FORMAT>(m_pixelFormat), 2);
3838

39-
// Creating our frame pool with 'Create' instead of 'CreateFreeThreaded'
40-
// means that the frame pool's FrameArrived event is called on the thread
41-
// the frame pool was created on. This also means that the creating thread
42-
// must have a DispatcherQueue. If you use this method, it's best not to do
43-
// it on the UI thread.
44-
m_framePool = winrt::Direct3D11CaptureFramePool::Create(m_device, m_pixelFormat, 2, m_item.Size());
39+
// We use 'CreateFreeThreaded' instead of 'Create' so that the FrameArrived
40+
// event fires on a thread other than our UI thread. If you use the 'Create'
41+
// method, it's best not to do it on the UI thread. Using the 'Create' method
42+
// also means you must have a DispatcherQueue on that thread and you must be
43+
// pumping messages.
44+
m_framePool = winrt::Direct3D11CaptureFramePool::CreateFreeThreaded(m_device, m_pixelFormat, 2, m_item.Size());
4545
m_session = m_framePool.CreateCaptureSession(m_item);
4646
m_lastSize = m_item.Size();
4747
m_framePool.FrameArrived({ this, &SimpleCapture::OnFrameArrived });

0 commit comments

Comments
 (0)