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
parent 590733b313
commit bd533dc31b
9 changed files with 101 additions and 7 deletions

View File

@@ -1,4 +1,6 @@
#include "display.h"
#include "misc.h"
#include "src/main.h"
namespace platf {
@@ -192,6 +194,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) {
auto &img_data = cursor.img_data;
@@ -307,6 +315,10 @@ namespace platf::dxgi {
blend_cursor(cursor, *img);
}
if (img) {
img->frame_timestamp = frame_timestamp;
}
return capture_e::ok;
}