#include "pch.h" #include #include "GpuMemoryBuffer.h" #include "GraphicsDevice/ITexture2D.h" #include "VideoFrameUtil.h" namespace unity { namespace webrtc { rtc::scoped_refptr CreateTestFrame(IGraphicsDevice* device, const ITexture2D* texture, UnityRenderingExtTextureFormat format) { NativeTexPtr ptr = NativeTexPtr(texture->GetNativeTexturePtrV()); Size size = Size(static_cast(texture->GetWidth()), static_cast(texture->GetHeight())); rtc::scoped_refptr gmb = new rtc::RefCountedObject(device, ptr, size, format); const int64_t timestamp_us = webrtc::Clock::GetRealTimeClock()->TimeInMicroseconds(); return VideoFrame::WrapExternalGpuMemoryBuffer( size, std::move(gmb), nullptr, webrtc::TimeDelta::Micros(timestamp_us)); } } // end namespace webrtc } // end namespace unity