mirror of
https://github.com/gnif/LookingGlass.git
synced 2026-08-09 00:31:31 +00:00
[client/obs] scheduler: correct phase feedback
Only report the client queue lead when JIT rendering provides a valid measurement. Clamp linear phase errors instead of wrapping them into the opposite direction at half of a refresh period. Timestamp OBS frames after the shared framebuffer becomes ready.
This commit is contained in:
@@ -98,11 +98,11 @@ void lgFrameSchedulerFeedback(LGFrameScheduler * scheduler,
|
||||
(int64_t)(measuredPhase - FRAME_SCHEDULER_TARGET_SLACK_NS) :
|
||||
-(int64_t)(FRAME_SCHEDULER_TARGET_SLACK_NS - measuredPhase);
|
||||
const int64_t period = (int64_t)scheduler->period;
|
||||
error %= period;
|
||||
if (error > period / 2)
|
||||
error -= period;
|
||||
else if (error < -period / 2)
|
||||
error += period;
|
||||
const int64_t limit = period / 2;
|
||||
if (error > limit)
|
||||
error = limit;
|
||||
else if (error < -limit)
|
||||
error = -limit;
|
||||
|
||||
if (!scheduler->feedbackSamples)
|
||||
scheduler->phaseError = error;
|
||||
|
||||
Reference in New Issue
Block a user