Extend packet header with frame processing latency

This commit is contained in:
ns6089 2023-04-18 19:03:52 +03:00 committed by Cameron Gutman
commit bd533dc31b
9 changed files with 101 additions and 7 deletions

View file

@ -11,6 +11,7 @@ extern "C" {
}
#include "display.h"
#include "misc.h"
#include "src/main.h"
#include "src/video.h"
@ -894,6 +895,12 @@ namespace platf::dxgi {
return capture_e::timeout;
}
std::optional<std::chrono::steady_clock::time_point> frame_timestamp;
if (auto qpc_displayed = std::max(frame_info.LastPresentTime.QuadPart, frame_info.LastMouseUpdateTime.QuadPart)) {
// Translate QueryPerformanceCounter() value to steady_clock time point
frame_timestamp = std::chrono::steady_clock::now() - qpc_time_difference(qpc_counter(), qpc_displayed);
}
if (frame_info.PointerShapeBufferSize > 0) {
DXGI_OUTDUPL_POINTER_SHAPE_INFO shape_info {};
@ -1239,6 +1246,10 @@ namespace platf::dxgi {
old_surface_delayed_destruction.reset();
}
if (img_out) {
img_out->frame_timestamp = frame_timestamp;
}
return capture_e::ok;
}