From e05ab04f676d7a48727148fc88f28f8a3e03a7f2 Mon Sep 17 00:00:00 2001 From: akallabeth Date: Sun, 25 Jan 2026 17:23:07 +0100 Subject: [PATCH] [channels,video] measure times in ns measure all times normalized to [ns] --- channels/video/client/video_main.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/channels/video/client/video_main.c b/channels/video/client/video_main.c index 0a32f05a5..954861218 100644 --- a/channels/video/client/video_main.c +++ b/channels/video/client/video_main.c @@ -845,8 +845,7 @@ static UINT video_VideoData(VideoClientContext* context, const TSMM_VIDEO_DATA* { VideoSurface* surface = presentation->surface; H264_CONTEXT* h264 = presentation->h264; - UINT64 startTime = GetTickCount64(); - UINT64 timeAfterH264 = 0; + const UINT64 startTime = winpr_GetTickCount64NS(); MAPPED_GEOMETRY* geom = presentation->geometry; const RECTANGLE_16 rect = { 0, 0, WINPR_ASSERTING_INT_CAST(UINT16, surface->alignedWidth), @@ -854,14 +853,14 @@ static UINT video_VideoData(VideoClientContext* context, const TSMM_VIDEO_DATA* Stream_SealLength(presentation->currentSample); Stream_SetPosition(presentation->currentSample, 0); - timeAfterH264 = GetTickCount64(); + const UINT64 timeAfterH264 = winpr_GetTickCount64NS(); if (data->SampleNumber == 1) { presentation->lastPublishTime = startTime; } - presentation->lastPublishTime += (data->hnsDuration / 10000); - if (presentation->lastPublishTime <= timeAfterH264 + 10) + presentation->lastPublishTime += 100ull * data->hnsDuration; + if (presentation->lastPublishTime <= (10000000ull + timeAfterH264)) { int dropped = 0;