MCPcopy Create free account
hub / github.com/RGAA-Software/GoDesk / CaptureNextFrame

Method CaptureNextFrame

src/render/plugins/dda_capture/dda_capture.cpp:267–297  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

265 }
266
267 HRESULT DDACapture::CaptureNextFrame(int wait_time, ComPtr<ID3D11Texture2D>& out_tex) {
268 DXGI_OUTDUPL_FRAME_INFO info;
269 ComPtr<IDXGIResource> resource;
270 ComPtr<ID3D11Texture2D> source;
271 HRESULT res;
272 if (!dxgi_output_duplication_.duplication_) {
273 if (!Init()) {
274 LOGE("Capture dxgi init failed!");
275 return S_FALSE;
276 }
277 if (!dxgi_output_duplication_.duplication_) {
278 return S_FALSE;
279 }
280 }
281 dxgi_output_duplication_.duplication_->ReleaseFrame();
282
283 res = dxgi_output_duplication_.duplication_->AcquireNextFrame(wait_time, &info, resource.GetAddressOf());
284 if (res != S_OK) {
285 return res;
286 }
287 res = resource->QueryInterface(__uuidof(ID3D11Texture2D), (void **) source.GetAddressOf());
288 if (res != S_OK) {
289 LOGE("QueryInterface failed when capturing: {}", StringUtil::GetErrorStr(res));
290 return res;
291 }
292 if (info.AccumulatedFrames == 0) {
293 return S_NOT_CHANGED;
294 }
295 out_tex = source;
296 return res;
297 }
298
299 void DDACapture::Capture() {
300 while (!stop_flag_) {

Callers

nothing calls this directly

Calls 1

QueryInterfaceMethod · 0.45

Tested by

no test coverage detected