#pragma once #include "VideoIOTypes.h" #include #include #include #include class OpenGLRenderer; class RuntimeHost; struct RenderPipelineFrameContext { VideoIOState videoState; VideoIOCompletion completion; }; class OpenGLVideoIOBridge { public: using RenderEffectCallback = std::function; using OutputReadyCallback = std::function; using PaintCallback = std::function; OpenGLVideoIOBridge( VideoIODevice& videoIO, OpenGLRenderer& renderer, RuntimeHost& runtimeHost, CRITICAL_SECTION& mutex, HDC hdc, HGLRC hglrc, RenderEffectCallback renderEffect, OutputReadyCallback outputReady, PaintCallback paint); void VideoFrameArrived(const VideoIOFrame& inputFrame); void PlayoutFrameCompleted(const VideoIOCompletion& completion); private: void RecordFramePacing(VideoIOCompletionResult completionResult); VideoIODevice& mVideoIO; OpenGLRenderer& mRenderer; RuntimeHost& mRuntimeHost; CRITICAL_SECTION& mMutex; HDC mHdc; HGLRC mHglrc; RenderEffectCallback mRenderEffect; OutputReadyCallback mOutputReady; PaintCallback mPaint; std::chrono::steady_clock::time_point mLastPlayoutCompletionTime; double mCompletionIntervalMilliseconds = 0.0; double mSmoothedCompletionIntervalMilliseconds = 0.0; double mMaxCompletionIntervalMilliseconds = 0.0; uint64_t mLateFrameCount = 0; uint64_t mDroppedFrameCount = 0; uint64_t mFlushedFrameCount = 0; };