PcloudStimBuff: Add skeleton daemon; frame rate limiting
Basic implementation of the stimbuff mechanism's frame rate limiting behaviour.
This commit is contained in:
@@ -1,6 +1,10 @@
|
||||
#ifndef _LIVOX_GEN1_PCLOUD_STIMULUS_BUFFER_H
|
||||
#define _LIVOX_GEN1_PCLOUD_STIMULUS_BUFFER_H
|
||||
|
||||
#include <config.h>
|
||||
#include <atomic>
|
||||
#include <boost/asio/deadline_timer.hpp>
|
||||
#include <spinLock.h>
|
||||
#include <user/stimulusBuffer.h>
|
||||
#include <user/stimFrame.h>
|
||||
#include <livoxProto1/device.h>
|
||||
@@ -26,13 +30,7 @@ public:
|
||||
const device::DeviceAttachmentSpec& deviceAttachmentSpec,
|
||||
std::shared_ptr<livoxProto1::Device> &device,
|
||||
const PcloudFormatDesc& formatDesc,
|
||||
size_t nDgramsPerStagingBufferFrame)
|
||||
: StimulusBuffer(deviceAttachmentSpec),
|
||||
deviceAttachmentSpec(deviceAttachmentSpec), device(device),
|
||||
formatDesc(formatDesc), stagingBuffer(
|
||||
StagingBuffer::InputEngineConstraints::ioUringConstraints,
|
||||
OpenClConstraints(), nDgramsPerStagingBufferFrame)
|
||||
{}
|
||||
size_t nDgramsPerStagingBufferFrame);
|
||||
|
||||
~PcloudStimulusBuffer() = default;
|
||||
|
||||
@@ -42,12 +40,25 @@ public:
|
||||
PcloudStimulusBuffer(PcloudStimulusBuffer&&) = default;
|
||||
PcloudStimulusBuffer& operator=(PcloudStimulusBuffer&&) = default;
|
||||
|
||||
// Control methods
|
||||
void start();
|
||||
void stop();
|
||||
|
||||
public:
|
||||
device::DeviceAttachmentSpec deviceAttachmentSpec;
|
||||
std::shared_ptr<livoxProto1::Device> device;
|
||||
PcloudFormatDesc formatDesc;
|
||||
StagingBuffer stagingBuffer;
|
||||
IoUringAssemblyEngine ioUringAssemblyEngine;
|
||||
|
||||
private:
|
||||
std::atomic<bool> shouldContinue;
|
||||
boost::asio::deadline_timer timer;
|
||||
SpinLock frameAssemblyRateLimiter;
|
||||
|
||||
private:
|
||||
void scheduleNextTimeout(int delayMs = CONFIG_STIMBUFF_FRAME_PERIOD_MS);
|
||||
void onTimeout(const boost::system::error_code& error);
|
||||
};
|
||||
|
||||
} // namespace stim_buff
|
||||
|
||||
Reference in New Issue
Block a user