Release duplication frame after snapshot

This commit is contained in:
ns6089
2023-05-12 17:34:50 +03:00
committed by Cameron Gutman
parent 730fce4b1c
commit 42a77b247e
+13 -7
View File
@@ -74,19 +74,20 @@ namespace platf::dxgi {
} }
auto status = dup->ReleaseFrame(); auto status = dup->ReleaseFrame();
has_frame = false;
switch (status) { switch (status) {
case S_OK: case S_OK:
has_frame = false;
return capture_e::ok; return capture_e::ok;
case DXGI_ERROR_WAIT_TIMEOUT:
return capture_e::timeout; case DXGI_ERROR_INVALID_CALL:
case WAIT_ABANDONED: BOOST_LOG(warning) << "Duplication frame already released";
return capture_e::ok;
case DXGI_ERROR_ACCESS_LOST: case DXGI_ERROR_ACCESS_LOST:
case DXGI_ERROR_ACCESS_DENIED:
has_frame = false;
return capture_e::reinit; return capture_e::reinit;
default: default:
BOOST_LOG(error) << "Couldn't release frame [0x"sv << util::hex(status).to_string_view(); BOOST_LOG(error) << "Error while releasing duplication frame [0x"sv << util::hex(status).to_string_view();
return capture_e::error; return capture_e::error;
} }
} }
@@ -174,6 +175,11 @@ namespace platf::dxgi {
BOOST_LOG(error) << "Unrecognized capture status ["sv << (int) status << ']'; BOOST_LOG(error) << "Unrecognized capture status ["sv << (int) status << ']';
return status; return status;
} }
status = dup.release_frame();
if (status != platf::capture_e::ok) {
return status;
}
} }
return capture_e::ok; return capture_e::ok;