#include "remoting/protocol/webrtc_connection_to_client.h"
#include <utility>
#include "base/functional/bind.h"
#include "base/location.h"
#include "base/logging.h"
#include "base/task/single_thread_task_runner.h"
#include "components/webrtc/thread_wrapper.h"
#include "net/base/io_buffer.h"
#include "remoting/base/logging.h"
#include "remoting/codec/video_encoder.h"
#include "remoting/codec/webrtc_video_encoder_vpx.h"
#include "remoting/protocol/audio_source.h"
#include "remoting/protocol/audio_stream.h"
#include "remoting/protocol/clipboard_stub.h"
#include "remoting/protocol/desktop_capturer.h"
#include "remoting/protocol/host_control_dispatcher.h"
#include "remoting/protocol/host_event_dispatcher.h"
#include "remoting/protocol/host_stub.h"
#include "remoting/protocol/input_stub.h"
#include "remoting/protocol/message_pipe.h"
#include "remoting/protocol/transport_context.h"
#include "remoting/protocol/webrtc_audio_stream.h"
#include "remoting/protocol/webrtc_transport.h"
#include "remoting/protocol/webrtc_video_encoder_factory.h"
#include "remoting/protocol/webrtc_video_stream.h"
#include "third_party/webrtc/api/media_stream_interface.h"
#include "third_party/webrtc/api/peer_connection_interface.h"
#include "third_party/webrtc/api/sctp_transport_interface.h"
namespace remoting::protocol {
namespace {
const char kVideoStatsStreamLabel[] = …;
}
WebrtcConnectionToClient::WebrtcConnectionToClient(
std::unique_ptr<protocol::Session> session,
scoped_refptr<protocol::TransportContext> transport_context,
scoped_refptr<base::SingleThreadTaskRunner> audio_task_runner)
: … { … }
WebrtcConnectionToClient::~WebrtcConnectionToClient() { … }
void WebrtcConnectionToClient::SetEventHandler(
ConnectionToClient::EventHandler* event_handler) { … }
protocol::Session* WebrtcConnectionToClient::session() { … }
void WebrtcConnectionToClient::Disconnect(ErrorCode error) { … }
std::unique_ptr<VideoStream> WebrtcConnectionToClient::StartVideoStream(
webrtc::ScreenId screen_id,
std::unique_ptr<DesktopCapturer> desktop_capturer) { … }
std::unique_ptr<AudioStream> WebrtcConnectionToClient::StartAudioStream(
std::unique_ptr<AudioSource> audio_source) { … }
ClientStub* WebrtcConnectionToClient::client_stub() { … }
void WebrtcConnectionToClient::set_clipboard_stub(
protocol::ClipboardStub* clipboard_stub) { … }
void WebrtcConnectionToClient::set_host_stub(protocol::HostStub* host_stub) { … }
void WebrtcConnectionToClient::set_input_stub(protocol::InputStub* input_stub) { … }
void WebrtcConnectionToClient::ApplySessionOptions(
const SessionOptions& options) { … }
void WebrtcConnectionToClient::ApplyNetworkSettings(
const NetworkSettings& settings) { … }
PeerConnectionControls* WebrtcConnectionToClient::peer_connection_controls() { … }
WebrtcEventLogData* WebrtcConnectionToClient::rtc_event_log() { … }
void WebrtcConnectionToClient::OnSessionStateChange(Session::State state) { … }
void WebrtcConnectionToClient::OnWebrtcTransportConnecting() { … }
void WebrtcConnectionToClient::OnWebrtcTransportConnected() { … }
void WebrtcConnectionToClient::OnWebrtcTransportError(ErrorCode error) { … }
void WebrtcConnectionToClient::OnWebrtcTransportProtocolChanged() { … }
void WebrtcConnectionToClient::OnWebrtcTransportIncomingDataChannel(
const std::string& name,
std::unique_ptr<MessagePipe> pipe) { … }
void WebrtcConnectionToClient::OnWebrtcTransportMediaStreamAdded(
rtc::scoped_refptr<webrtc::MediaStreamInterface> stream) { … }
void WebrtcConnectionToClient::OnWebrtcTransportMediaStreamRemoved(
rtc::scoped_refptr<webrtc::MediaStreamInterface> stream) { … }
void WebrtcConnectionToClient::OnWebrtcTransportRouteChanged(
const TransportRoute& route) { … }
void WebrtcConnectionToClient::OnChannelInitialized(
ChannelDispatcherBase* channel_dispatcher) { … }
void WebrtcConnectionToClient::OnChannelClosed(
ChannelDispatcherBase* channel_dispatcher) { … }
bool WebrtcConnectionToClient::allChannelsConnected() { … }
}