整理代码
This commit is contained in:
commit
c7b4e178ec
364 changed files with 59691 additions and 0 deletions
58
video/core/FrameSynchronizer.h
Normal file
58
video/core/FrameSynchronizer.h
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
#ifndef B6D2EB85_A2D9_4037_BDBB_5ADCDA3E3B01
|
||||
#define B6D2EB85_A2D9_4037_BDBB_5ADCDA3E3B01
|
||||
/*
|
||||
*******************************************************************************
|
||||
* INCLUDE
|
||||
*******************************************************************************
|
||||
*/
|
||||
#include "System.h"
|
||||
#include "util/ClassAssistant.h"
|
||||
#include <atomic>
|
||||
#include <cmath>
|
||||
#include <chrono>
|
||||
#include <mutex>
|
||||
#include <deque>
|
||||
|
||||
namespace Video
|
||||
{
|
||||
namespace Core
|
||||
{
|
||||
/*
|
||||
*******************************************************************************
|
||||
* CLASS DECLARE
|
||||
*******************************************************************************
|
||||
*/
|
||||
class FrameSynchronizer
|
||||
{
|
||||
public:
|
||||
FrameSynchronizer(const std::string& name);
|
||||
~FrameSynchronizer();
|
||||
|
||||
void syncFrame(uint64_t frameTs);
|
||||
|
||||
void reset();
|
||||
|
||||
private:
|
||||
class DriftPredictor
|
||||
{
|
||||
public:
|
||||
DriftPredictor(size_t windowSize = 10);
|
||||
void update(int64_t drift);
|
||||
int64_t predict();
|
||||
void reset();
|
||||
|
||||
private:
|
||||
std::deque<int64_t> _samples;
|
||||
size_t _windowSize;
|
||||
double _lastPrediction;
|
||||
};
|
||||
|
||||
READONLY_PROPERTY_DECLARE(name, std::string)
|
||||
|
||||
uint64_t _baseClock;
|
||||
uint64_t _lastSysTS;
|
||||
DriftPredictor _predictor;
|
||||
};
|
||||
}
|
||||
}
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue