INput
This commit is contained in:
49
apps/RenderCadenceCompositor/video/SyntheticInputProducer.h
Normal file
49
apps/RenderCadenceCompositor/video/SyntheticInputProducer.h
Normal file
@@ -0,0 +1,49 @@
|
||||
#pragma once
|
||||
|
||||
#include "../frames/InputFrameMailbox.h"
|
||||
|
||||
#include <atomic>
|
||||
#include <chrono>
|
||||
#include <cstdint>
|
||||
#include <thread>
|
||||
#include <vector>
|
||||
|
||||
namespace RenderCadenceCompositor
|
||||
{
|
||||
struct SyntheticInputProducerConfig
|
||||
{
|
||||
unsigned width = 1920;
|
||||
unsigned height = 1080;
|
||||
double frameDurationMilliseconds = 1000.0 / 59.94;
|
||||
};
|
||||
|
||||
struct SyntheticInputProducerMetrics
|
||||
{
|
||||
uint64_t generatedFrames = 0;
|
||||
uint64_t submitMisses = 0;
|
||||
};
|
||||
|
||||
class SyntheticInputProducer
|
||||
{
|
||||
public:
|
||||
SyntheticInputProducer(InputFrameMailbox& mailbox, SyntheticInputProducerConfig config);
|
||||
SyntheticInputProducer(const SyntheticInputProducer&) = delete;
|
||||
SyntheticInputProducer& operator=(const SyntheticInputProducer&) = delete;
|
||||
~SyntheticInputProducer();
|
||||
|
||||
bool Start();
|
||||
void Stop();
|
||||
SyntheticInputProducerMetrics Metrics() const;
|
||||
|
||||
private:
|
||||
void ThreadMain();
|
||||
void GenerateFrame(uint64_t frameIndex, std::vector<unsigned char>& buffer) const;
|
||||
|
||||
InputFrameMailbox& mMailbox;
|
||||
SyntheticInputProducerConfig mConfig;
|
||||
std::thread mThread;
|
||||
std::atomic<bool> mStopping{ false };
|
||||
std::atomic<uint64_t> mGeneratedFrames{ 0 };
|
||||
std::atomic<uint64_t> mSubmitMisses{ 0 };
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user