only rely on history if clock_offset is stable

This commit is contained in:
galister
2024-09-03 18:00:28 +02:00
committed by xytovl
parent 9689cbf822
commit 3f25fed6df
5 changed files with 27 additions and 26 deletions
+10
View File
@@ -20,6 +20,7 @@
#pragma once
#include "clock_offset.h"
#include "util/u_logging.h"
#include <algorithm>
#include <cstddef>
#include <list>
@@ -47,6 +48,15 @@ protected:
// Discard outdated data, packets could be reordered
if (not data.empty())
{
// keep only one sample if the clock_offset is unreliable
if (not offset)
{
U_LOG_D("not using history: clock_offset not stable");
data.clear();
data.emplace_back(sample, produced, t);
return;
}
if (data.back().produced_timestamp > produced)
return;
}