47 lines
982 B
C++
47 lines
982 B
C++
#pragma once
|
|
|
|
#include "VideoPlayoutPolicy.h"
|
|
|
|
#include <cstddef>
|
|
#include <cstdint>
|
|
#include <string>
|
|
|
|
enum class OutputProductionAction
|
|
{
|
|
Produce,
|
|
Wait,
|
|
Throttle
|
|
};
|
|
|
|
struct OutputProductionPressure
|
|
{
|
|
std::size_t readyQueueDepth = 0;
|
|
std::size_t readyQueueCapacity = 0;
|
|
uint64_t readyQueueUnderrunCount = 0;
|
|
uint64_t lateStreak = 0;
|
|
uint64_t dropStreak = 0;
|
|
};
|
|
|
|
struct OutputProductionDecision
|
|
{
|
|
OutputProductionAction action = OutputProductionAction::Wait;
|
|
std::size_t requestedFrames = 0;
|
|
std::size_t targetReadyFrames = 0;
|
|
std::size_t maxReadyFrames = 0;
|
|
std::string reason;
|
|
};
|
|
|
|
class OutputProductionController
|
|
{
|
|
public:
|
|
explicit OutputProductionController(const VideoPlayoutPolicy& policy = VideoPlayoutPolicy());
|
|
|
|
void Configure(const VideoPlayoutPolicy& policy);
|
|
OutputProductionDecision Decide(const OutputProductionPressure& pressure) const;
|
|
|
|
private:
|
|
VideoPlayoutPolicy mPolicy;
|
|
};
|
|
|
|
const char* OutputProductionActionName(OutputProductionAction action);
|