perf(tracker): low-latency capture - MF_LOW_LATENCY + dedicated capture thread that keeps only the latest frame (inference never processes a stale backlogged frame)

This commit is contained in:
kinect-bot committed 2026-11-26 03:07:10 -05:00
1 parent 36035cc9a2
commit 03e3a1808c
2 files changed
+51 -3

No files matched your search

+3
View File
@@ -119,6 +119,9 @@ bool Camera::open(const std::wstring& symbolic_link, int width, int height) {
IMFAttributes* ra = nullptr;
MFCreateAttributes(&ra, 1);
ra->SetUINT32(MF_SOURCE_READER_ENABLE_ADVANCED_VIDEO_PROCESSING, TRUE);
// Cut the source reader's internal frame buffering so ReadSample returns the
// freshest frame instead of a queued (stale) one - critical for low latency.
ra->SetUINT32(MF_LOW_LATENCY, TRUE);
IMFSourceReader* reader = nullptr;
HRESULT hr = MFCreateSourceReaderFromMediaSource(src, ra, &reader);
SafeRelease(&ra);