// Copyright Epic Games, Inc. All Rights Reserved. #pragma once #include "Containers/Set.h" #include "EpicRtcTrack.h" #include "VideoCapturer.h" #include "VideoSink.h" #include "RendererInterface.h" #include "epic_rtc/core/video/video_frame.h" namespace UE::PixelStreaming2 { /** * Video sink class that receives a frame from EpicRtc and passes the frame to all added consumers */ class PIXELSTREAMING2RTC_API FEpicRtcVideoSink : public FVideoSink, public TEpicRtcTrack, public TSharedFromThis { public: static TSharedPtr Create(TRefCountPtr InTrack); // Note: destructor will call destroy on any attached video consumers virtual ~FEpicRtcVideoSink() = default; void OnEpicRtcFrame(const EpicRtcVideoFrame& Frame); private: FEpicRtcVideoSink(TRefCountPtr InTrack); void OnFrameCaptured(); FCriticalSection RenderSyncContext; FPooledRenderTargetDesc RenderTargetDescriptor; TRefCountPtr RenderTarget; TArray Buffer; FTextureRHIRef SourceTexture; TSharedPtr VideoCapturer; }; } // namespace UE::PixelStreaming2