#include "remoting/protocol/video_frame_pump.h"
#include <algorithm>
#include <memory>
#include <utility>
#include "base/check.h"
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/task/single_thread_task_runner.h"
#include "base/time/time.h"
#include "remoting/base/constants.h"
#include "remoting/proto/control.pb.h"
#include "remoting/proto/video.pb.h"
#include "remoting/protocol/desktop_capturer.h"
#include "remoting/protocol/video_stub.h"
#include "third_party/webrtc/modules/desktop_capture/desktop_frame.h"
namespace remoting::protocol {
static const int kKeepAlivePacketIntervalMs = …;
VideoFramePump::FrameTimestamps::FrameTimestamps() = default;
VideoFramePump::FrameTimestamps::~FrameTimestamps() = default;
VideoFramePump::PacketWithTimestamps::PacketWithTimestamps(
std::unique_ptr<VideoPacket> packet,
std::unique_ptr<FrameTimestamps> timestamps)
: … { … }
VideoFramePump::PacketWithTimestamps::~PacketWithTimestamps() = default;
VideoFramePump::VideoFramePump(
scoped_refptr<base::SingleThreadTaskRunner> encode_task_runner,
std::unique_ptr<DesktopCapturer> capturer,
std::unique_ptr<VideoEncoder> encoder,
protocol::VideoStub* video_stub)
: … { … }
VideoFramePump::~VideoFramePump() { … }
void VideoFramePump::SetEventTimestampsSource(
scoped_refptr<InputEventTimestampsSource> event_timestamps_source) { … }
void VideoFramePump::Pause(bool pause) { … }
void VideoFramePump::SetObserver(Observer* observer) { … }
void VideoFramePump::SelectSource(webrtc::ScreenId id) { … }
void VideoFramePump::SetComposeEnabled(bool enabled) { … }
void VideoFramePump::SetMouseCursor(
std::unique_ptr<webrtc::MouseCursor> mouse_cursor) { … }
void VideoFramePump::SetMouseCursorPosition(
const webrtc::DesktopVector& position) { … }
void VideoFramePump::SetTargetFramerate(int framerate) { … }
void VideoFramePump::OnCaptureResult(
webrtc::DesktopCapturer::Result result,
std::unique_ptr<webrtc::DesktopFrame> frame) { … }
void VideoFramePump::CaptureNextFrame() { … }
std::unique_ptr<VideoFramePump::PacketWithTimestamps>
VideoFramePump::EncodeFrame(VideoEncoder* encoder,
std::unique_ptr<webrtc::DesktopFrame> frame,
std::unique_ptr<FrameTimestamps> timestamps) { … }
void VideoFramePump::OnFrameEncoded(
std::unique_ptr<PacketWithTimestamps> packet) { … }
void VideoFramePump::SendPacket(std::unique_ptr<PacketWithTimestamps> packet) { … }
void VideoFramePump::UpdateFrameTimers(VideoPacket* packet,
FrameTimestamps* timestamps) { … }
void VideoFramePump::OnVideoPacketSent() { … }
void VideoFramePump::SendKeepAlivePacket() { … }
void VideoFramePump::OnKeepAlivePacketSent() { … }
}