#include "remoting/protocol/webrtc_video_renderer_adapter.h"
#include <memory>
#include <string>
#include <utility>
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/location.h"
#include "base/logging.h"
#include "base/memory/ptr_util.h"
#include "base/task/single_thread_task_runner.h"
#include "base/task/thread_pool.h"
#include "remoting/protocol/client_video_stats_dispatcher.h"
#include "remoting/protocol/frame_consumer.h"
#include "remoting/protocol/frame_stats.h"
#include "remoting/protocol/video_renderer.h"
#include "remoting/protocol/webrtc_transport.h"
#include "third_party/libyuv/include/libyuv/convert.h"
#include "third_party/libyuv/include/libyuv/convert_from.h"
#include "third_party/webrtc/modules/desktop_capture/desktop_frame.h"
namespace remoting::protocol {
namespace {
const int kMaxQueuedStats = …;
std::unique_ptr<webrtc::DesktopFrame> ConvertYuvToRgb(
scoped_refptr<webrtc::VideoFrameBuffer> yuv_frame,
std::unique_ptr<webrtc::DesktopFrame> rgb_frame,
FrameConsumer::PixelFormat pixel_format) { … }
}
WebrtcVideoRendererAdapter::WebrtcVideoRendererAdapter(
const std::string& label,
VideoRenderer* video_renderer)
: … { … }
WebrtcVideoRendererAdapter::~WebrtcVideoRendererAdapter() { … }
void WebrtcVideoRendererAdapter::SetMediaStream(
rtc::scoped_refptr<webrtc::MediaStreamInterface> media_stream) { … }
void WebrtcVideoRendererAdapter::SetVideoStatsChannel(
std::unique_ptr<MessagePipe> message_pipe) { … }
void WebrtcVideoRendererAdapter::OnFrame(const webrtc::VideoFrame& frame) { … }
void WebrtcVideoRendererAdapter::OnVideoFrameStats(
uint32_t rtp_timestamp,
const HostFrameStats& host_stats) { … }
void WebrtcVideoRendererAdapter::OnChannelInitialized(
ChannelDispatcherBase* channel_dispatcher) { … }
void WebrtcVideoRendererAdapter::OnChannelClosed(
ChannelDispatcherBase* channel_dispatcher) { … }
void WebrtcVideoRendererAdapter::HandleFrameOnMainThread(
uint32_t rtp_timestamp,
base::TimeTicks time_received,
scoped_refptr<webrtc::VideoFrameBuffer> frame) { … }
void WebrtcVideoRendererAdapter::DrawFrame(
uint32_t rtp_timestamp,
std::unique_ptr<ClientFrameStats> stats,
std::unique_ptr<webrtc::DesktopFrame> frame) { … }
void WebrtcVideoRendererAdapter::FrameRendered(
uint32_t rtp_timestamp,
std::unique_ptr<ClientFrameStats> client_stats) { … }
}