diff options
author | sergeyu <sergeyu@chromium.org> | 2015-11-29 22:25:39 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-11-30 06:26:23 +0000 |
commit | a609b7a407e9a009d963f5c3c799a0bccc1be658 (patch) | |
tree | 96dabc8aa34c209f3626c043dca170a7ad5df54b | |
parent | f7f0d1d23ead16ea0461f9cf5eb7b7a65342d18d (diff) | |
download | chromium_src-a609b7a407e9a009d963f5c3c799a0bccc1be658.zip chromium_src-a609b7a407e9a009d963f5c3c799a0bccc1be658.tar.gz chromium_src-a609b7a407e9a009d963f5c3c799a0bccc1be658.tar.bz2 |
Add VideoStream interface.
Added new VideoStream interface. VideoFramePump implements it. Later
there will be a separate implementation for WebRTC-based protocol.
ConnectionToClient is responsible for VideoStream creation.
BUG=547158
Review URL: https://codereview.chromium.org/1472873005
Cr-Commit-Position: refs/heads/master@{#362096}
20 files changed, 284 insertions, 243 deletions
diff --git a/remoting/host/chromoting_host.cc b/remoting/host/chromoting_host.cc index 33b3d4b..c640cdb 100644 --- a/remoting/host/chromoting_host.cc +++ b/remoting/host/chromoting_host.cc @@ -275,7 +275,8 @@ void ChromotingHost::OnIncomingSession( // Create a client object. scoped_ptr<protocol::ConnectionToClient> connection( - new protocol::IceConnectionToClient(make_scoped_ptr(session))); + new protocol::IceConnectionToClient(make_scoped_ptr(session), + video_encode_task_runner_)); ClientSession* client = new ClientSession( this, audio_task_runner_, diff --git a/remoting/host/chromoting_host_unittest.cc b/remoting/host/chromoting_host_unittest.cc index e5d7046..c7bc951 100644 --- a/remoting/host/chromoting_host_unittest.cc +++ b/remoting/host/chromoting_host_unittest.cc @@ -108,20 +108,13 @@ class ChromotingHostTest : public testing::Test { new protocol::FakeConnectionToClient(make_scoped_ptr(session1_))); owned_connection1_->set_host_stub(&host_stub1_); connection1_ = owned_connection1_.get(); - connection1_->set_video_stub(&video_stub1_); connection1_->set_client_stub(&client_stub1_); owned_connection2_.reset( new protocol::FakeConnectionToClient(make_scoped_ptr(session2_))); owned_connection2_->set_host_stub(&host_stub2_); connection2_ = owned_connection2_.get(); - connection2_->set_video_stub(&video_stub2_); connection2_->set_client_stub(&client_stub2_); - - ON_CALL(video_stub1_, ProcessVideoPacketPtr(_, _)) - .WillByDefault(DeleteArg<0>()); - ON_CALL(video_stub2_, ProcessVideoPacketPtr(_, _)) - .WillByDefault(DeleteArg<0>()); } // Helper method to pretend a client is connected to ChromotingHost. @@ -234,7 +227,6 @@ class ChromotingHostTest : public testing::Test { std::string session_jid1_; MockSession* session1_; // Owned by |connection_|. scoped_ptr<SessionConfig> session_config1_; - MockVideoStub video_stub1_; MockClientStub client_stub1_; MockHostStub host_stub1_; protocol::FakeConnectionToClient* connection2_; @@ -243,7 +235,6 @@ class ChromotingHostTest : public testing::Test { std::string session_jid2_; MockSession* session2_; // Owned by |connection2_|. scoped_ptr<SessionConfig> session_config2_; - MockVideoStub video_stub2_; MockClientStub client_stub2_; MockHostStub host_stub2_; scoped_ptr<MockSession> session_unowned1_; // Not owned by a connection. diff --git a/remoting/host/client_session.cc b/remoting/host/client_session.cc index d12a5ed..b79d7b1 100644 --- a/remoting/host/client_session.cc +++ b/remoting/host/client_session.cc @@ -14,9 +14,6 @@ #include "remoting/codec/audio_encoder.h" #include "remoting/codec/audio_encoder_opus.h" #include "remoting/codec/audio_encoder_verbatim.h" -#include "remoting/codec/video_encoder.h" -#include "remoting/codec/video_encoder_verbatim.h" -#include "remoting/codec/video_encoder_vpx.h" #include "remoting/host/audio_capturer.h" #include "remoting/host/audio_pump.h" #include "remoting/host/desktop_capturer_proxy.h" @@ -47,22 +44,6 @@ namespace { // Name of command-line flag to disable use of I444 by default. const char kDisableI444SwitchName[] = "disable-i444"; -scoped_ptr<VideoEncoder> CreateVideoEncoder( - const protocol::SessionConfig& config) { - const protocol::ChannelConfig& video_config = config.video_config(); - - if (video_config.codec == protocol::ChannelConfig::CODEC_VP8) { - return VideoEncoderVpx::CreateForVP8().Pass(); - } else if (video_config.codec == protocol::ChannelConfig::CODEC_VP9) { - return VideoEncoderVpx::CreateForVP9().Pass(); - } else if (video_config.codec == protocol::ChannelConfig::CODEC_VERBATIM) { - return make_scoped_ptr(new VideoEncoderVerbatim()); - } - - NOTREACHED(); - return nullptr; -} - scoped_ptr<AudioEncoder> CreateAudioEncoder( const protocol::SessionConfig& config) { const protocol::ChannelConfig& audio_config = config.audio_config(); @@ -99,7 +80,7 @@ ClientSession::ClientSession( input_tracker_(&host_input_filter_), remote_input_filter_(&input_tracker_), mouse_clamping_filter_(&remote_input_filter_), - disable_input_filter_(mouse_clamping_filter_.input_filter()), + disable_input_filter_(&mouse_clamping_filter_), disable_clipboard_filter_(clipboard_echo_filter_.host_filter()), client_clipboard_factory_(clipboard_echo_filter_.client_filter()), max_duration_(max_duration), @@ -136,7 +117,7 @@ ClientSession::~ClientSession() { DCHECK(!desktop_environment_); DCHECK(!input_injector_); DCHECK(!screen_controls_); - DCHECK(!video_frame_pump_); + DCHECK(!video_stream_); connection_.reset(); } @@ -171,28 +152,28 @@ void ClientSession::NotifyClientResolution( void ClientSession::ControlVideo(const protocol::VideoControl& video_control) { DCHECK(CalledOnValidThread()); - // Note that |video_frame_pump_| may be null, depending upon whether + // Note that |video_stream_| may be null, depending upon whether // extensions choose to wrap or "steal" the video capturer or encoder. if (video_control.has_enable()) { VLOG(1) << "Received VideoControl (enable=" << video_control.enable() << ")"; pause_video_ = !video_control.enable(); - if (video_frame_pump_) - video_frame_pump_->Pause(pause_video_); + if (video_stream_) + video_stream_->Pause(pause_video_); } if (video_control.has_lossless_encode()) { VLOG(1) << "Received VideoControl (lossless_encode=" << video_control.lossless_encode() << ")"; lossless_video_encode_ = video_control.lossless_encode(); - if (video_frame_pump_) - video_frame_pump_->SetLosslessEncode(lossless_video_encode_); + if (video_stream_) + video_stream_->SetLosslessEncode(lossless_video_encode_); } if (video_control.has_lossless_color()) { VLOG(1) << "Received VideoControl (lossless_color=" << video_control.lossless_color() << ")"; lossless_video_color_ = video_control.lossless_color(); - if (video_frame_pump_) - video_frame_pump_->SetLosslessColor(lossless_video_color_); + if (video_stream_) + video_stream_->SetLosslessColor(lossless_video_color_); } } @@ -285,7 +266,7 @@ void ClientSession::OnConnectionAuthenticated( DCHECK(!desktop_environment_); DCHECK(!input_injector_); DCHECK(!screen_controls_); - DCHECK(!video_frame_pump_); + DCHECK(!video_stream_); is_authenticated_ = true; @@ -311,9 +292,6 @@ void ClientSession::OnConnectionAuthenticated( // Connect host stub. connection_->set_host_stub(this); - // Connect video stub. - mouse_clamping_filter_.set_video_stub(connection_->video_stub()); - // Collate the set of capabilities to offer the client, if it supports them. host_capabilities_ = desktop_environment_->GetCapabilities(); if (!host_capabilities_.empty()) @@ -392,7 +370,7 @@ void ClientSession::OnConnectionClosed( // Stop components access the client, audio or video stubs, which are no // longer valid once ConnectionToClient calls OnConnectionClosed(). audio_pump_.reset(); - video_frame_pump_.reset(); + video_stream_.reset(); mouse_shape_pump_.reset(); client_clipboard_factory_.InvalidateWeakPtrs(); input_injector_.reset(); @@ -403,14 +381,19 @@ void ClientSession::OnConnectionClosed( event_handler_->OnSessionClosed(this); } +void ClientSession::OnCreateVideoEncoder(scoped_ptr<VideoEncoder>* encoder) { + DCHECK(CalledOnValidThread()); + extension_manager_->OnCreateVideoEncoder(encoder); +} + void ClientSession::OnInputEventReceived( protocol::ConnectionToClient* connection, int64_t event_timestamp) { DCHECK(CalledOnValidThread()); DCHECK_EQ(connection_.get(), connection); - if (video_frame_pump_.get()) - video_frame_pump_->OnInputEventReceived(event_timestamp); + if (video_stream_.get()) + video_stream_->OnInputEventReceived(event_timestamp); } void ClientSession::OnRouteChange( @@ -455,21 +438,18 @@ void ClientSession::SetDisableInputs(bool disable_inputs) { void ClientSession::ResetVideoPipeline() { DCHECK(CalledOnValidThread()); + video_stream_.reset(); mouse_shape_pump_.reset(); - connection_->set_video_feedback_stub(nullptr); - video_frame_pump_.reset(); // Create VideoEncoder and DesktopCapturer to match the session's video // channel configuration. scoped_ptr<webrtc::DesktopCapturer> video_capturer = desktop_environment_->CreateVideoCapturer(); extension_manager_->OnCreateVideoCapturer(&video_capturer); - scoped_ptr<VideoEncoder> video_encoder = - CreateVideoEncoder(connection_->session()->config()); - extension_manager_->OnCreateVideoEncoder(&video_encoder); - // Don't start the VideoFramePump if either capturer or encoder are missing. - if (!video_capturer || !video_encoder) + // Don't start the video stream if the extension took ownership of the + // capturer. + if (!video_capturer) return; // Create MouseShapePump to send mouse cursor shape. @@ -478,25 +458,23 @@ void ClientSession::ResetVideoPipeline() { desktop_environment_->CreateMouseCursorMonitor(), connection_->client_stub())); - // Create a VideoFramePump to pump frames from the capturer to the client.' - // + // Create a VideoStream to pump frames from the capturer to the client. + // TODO(sergeyu): Move DesktopCapturerProxy creation to DesktopEnvironment. // When using IpcDesktopCapturer the capture thread is not useful. - scoped_ptr<DesktopCapturerProxy> capturer_proxy(new DesktopCapturerProxy( + scoped_ptr<webrtc::DesktopCapturer> capturer_proxy(new DesktopCapturerProxy( video_capture_task_runner_, video_capturer.Pass())); - video_frame_pump_.reset(new protocol::VideoFramePump( - video_encode_task_runner_, capturer_proxy.Pass(), video_encoder.Pass(), - &mouse_clamping_filter_)); - // Apply video-control parameters to the new scheduler. - video_frame_pump_->SetLosslessEncode(lossless_video_encode_); - video_frame_pump_->SetLosslessColor(lossless_video_color_); + video_stream_ = connection_->StartVideoStream(capturer_proxy.Pass()); + video_stream_->SetSizeCallback( + base::Bind(&ClientSession::OnScreenSizeChanged, base::Unretained(this))); - // Pause capturing if necessary. - video_frame_pump_->Pause(pause_video_); + // Apply video-control parameters to the new stream. + video_stream_->SetLosslessEncode(lossless_video_encode_); + video_stream_->SetLosslessColor(lossless_video_color_); - connection_->set_video_feedback_stub( - video_frame_pump_->video_feedback_stub()); + // Pause capturing if necessary. + video_stream_->Pause(pause_video_); } void ClientSession::SetGnubbyAuthHandlerForTesting( @@ -513,4 +491,10 @@ scoped_ptr<protocol::ClipboardStub> ClientSession::CreateClipboardProxy() { base::ThreadTaskRunnerHandle::Get())); } +void ClientSession::OnScreenSizeChanged(const webrtc::DesktopSize& size) { + DCHECK(CalledOnValidThread()); + mouse_clamping_filter_.set_input_size(size); + mouse_clamping_filter_.set_output_size(size); +} + } // namespace remoting diff --git a/remoting/host/client_session.h b/remoting/host/client_session.h index aa4efc5..2c220b6 100644 --- a/remoting/host/client_session.h +++ b/remoting/host/client_session.h @@ -16,7 +16,6 @@ #include "remoting/host/client_session_control.h" #include "remoting/host/gnubby_auth_handler.h" #include "remoting/host/host_extension_session_manager.h" -#include "remoting/host/mouse_clamping_filter.h" #include "remoting/host/remote_input_filter.h" #include "remoting/protocol/clipboard_echo_filter.h" #include "remoting/protocol/clipboard_filter.h" @@ -26,6 +25,7 @@ #include "remoting/protocol/input_event_tracker.h" #include "remoting/protocol/input_filter.h" #include "remoting/protocol/input_stub.h" +#include "remoting/protocol/mouse_input_filter.h" #include "remoting/protocol/pairing_registry.h" #include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h" @@ -42,10 +42,6 @@ class InputInjector; class MouseShapePump; class ScreenControls; -namespace protocol { -class VideoFramePump; -} // namespace protocol - // A ClientSession keeps a reference to a connection to a client, and maintains // per-client state. class ClientSession @@ -124,6 +120,7 @@ class ClientSession protocol::ConnectionToClient* connection) override; void OnConnectionClosed(protocol::ConnectionToClient* connection, protocol::ErrorCode error) override; + void OnCreateVideoEncoder(scoped_ptr<VideoEncoder>* encoder) override; void OnInputEventReceived(protocol::ConnectionToClient* connection, int64_t timestamp) override; void OnRouteChange(protocol::ConnectionToClient* connection, @@ -153,6 +150,8 @@ class ClientSession // Creates a proxy for sending clipboard events to the client. scoped_ptr<protocol::ClipboardStub> CreateClipboardProxy(); + void OnScreenSizeChanged(const webrtc::DesktopSize& size); + EventHandler* event_handler_; // The connection to the client. @@ -176,7 +175,7 @@ class ClientSession RemoteInputFilter remote_input_filter_; // Filter used to clamp mouse events to the current display dimensions. - MouseClampingFilter mouse_clamping_filter_; + protocol::MouseInputFilter mouse_clamping_filter_; // Filter to used to stop clipboard items sent from the client being echoed // back to it. It is the final element in the clipboard (client -> host) @@ -207,11 +206,11 @@ class ClientSession scoped_refptr<base::SingleThreadTaskRunner> network_task_runner_; scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_; - // Pumps for audio, video and mouse shape. - // |video_frame_pump_| and |mouse_shape_pump_| may be nullptr if the video + // Objects responsible for sending video, audio and mouse shape. + // |video_stream_| and |mouse_shape_pump_| may be nullptr if the video // stream is handled by an extension, see ResetVideoPipeline(). scoped_ptr<AudioPump> audio_pump_; - scoped_ptr<protocol::VideoFramePump> video_frame_pump_; + scoped_ptr<protocol::VideoStream> video_stream_; scoped_ptr<MouseShapePump> mouse_shape_pump_; // The set of all capabilities supported by the client. diff --git a/remoting/host/client_session_unittest.cc b/remoting/host/client_session_unittest.cc index a341391..38d66ef 100644 --- a/remoting/host/client_session_unittest.cc +++ b/remoting/host/client_session_unittest.cc @@ -12,6 +12,7 @@ #include "base/strings/string_util.h" #include "remoting/base/auto_thread_task_runner.h" #include "remoting/base/constants.h" +#include "remoting/codec/video_encoder_verbatim.h" #include "remoting/host/client_session.h" #include "remoting/host/desktop_environment.h" #include "remoting/host/fake_desktop_environment.h" @@ -104,8 +105,8 @@ class ClientSessionTest : public testing::Test { // the input pipe line and starts video capturing. void ConnectClientSession(); - // Waits for the first frame to be processed. - void WaitFirstFrame(); + // Fakes video size notification from the VideoStream. + void NotifyVideoSize(); // Creates expectations to send an extension message and to disconnect // afterwards. @@ -137,7 +138,6 @@ class ClientSessionTest : public testing::Test { // Stubs returned to |client_session_| components by |connection_|. MockClientStub client_stub_; - MockVideoStub video_stub_; // ClientSession owns |connection_| but tests need it to inject fake events. protocol::FakeConnectionToClient* connection_; @@ -178,7 +178,6 @@ void ClientSessionTest::CreateClientSession() { scoped_ptr<protocol::FakeConnectionToClient> connection( new protocol::FakeConnectionToClient(session.Pass())); connection->set_client_stub(&client_stub_); - connection->set_video_stub(&video_stub_); connection_ = connection.get(); client_session_.reset(new ClientSession( @@ -212,21 +211,16 @@ void ClientSessionTest::ConnectClientSession() { client_session_->OnConnectionChannelsConnected(client_session_->connection()); } -void ClientSessionTest::WaitFirstFrame() { - // Wait for the first video packet to be captured to make sure that - // the injected input will go though. Otherwise mouse events will be blocked - // by the mouse clamping filter. - base::RunLoop run_loop; - EXPECT_CALL(video_stub_, ProcessVideoPacketPtr(_, _)) - .Times(AtLeast(1)) - .WillOnce(testing::InvokeWithoutArgs(&run_loop, &base::RunLoop::Quit)); - run_loop.Run(); +void ClientSessionTest::NotifyVideoSize() { + connection_->last_video_stream()->size_callback().Run( + webrtc::DesktopSize(protocol::FakeDesktopCapturer::kWidth, + protocol::FakeDesktopCapturer::kHeight)); } TEST_F(ClientSessionTest, DisableInputs) { CreateClientSession(); ConnectClientSession(); - WaitFirstFrame(); + NotifyVideoSize(); FakeInputInjector* input_injector = desktop_environment_factory_->last_desktop_environment() @@ -282,7 +276,8 @@ TEST_F(ClientSessionTest, DisableInputs) { TEST_F(ClientSessionTest, LocalInputTest) { CreateClientSession(); ConnectClientSession(); - WaitFirstFrame(); + NotifyVideoSize(); + std::vector<protocol::MouseEvent> mouse_events; desktop_environment_factory_->last_desktop_environment() @@ -317,7 +312,7 @@ TEST_F(ClientSessionTest, LocalInputTest) { TEST_F(ClientSessionTest, RestoreEventState) { CreateClientSession(); ConnectClientSession(); - WaitFirstFrame(); + NotifyVideoSize(); FakeInputInjector* input_injector = desktop_environment_factory_->last_desktop_environment() @@ -355,7 +350,7 @@ TEST_F(ClientSessionTest, RestoreEventState) { TEST_F(ClientSessionTest, ClampMouseEvents) { CreateClientSession(); ConnectClientSession(); - WaitFirstFrame(); + NotifyVideoSize(); std::vector<protocol::MouseEvent> mouse_events; desktop_environment_factory_->last_desktop_environment() @@ -384,7 +379,7 @@ TEST_F(ClientSessionTest, ClampMouseEvents) { TEST_F(ClientSessionTest, NoGnubbyAuth) { CreateClientSession(); ConnectClientSession(); - WaitFirstFrame(); + NotifyVideoSize(); protocol::ExtensionMessage message; message.set_type("gnubby-auth"); @@ -397,7 +392,7 @@ TEST_F(ClientSessionTest, NoGnubbyAuth) { TEST_F(ClientSessionTest, EnableGnubbyAuth) { CreateClientSession(); ConnectClientSession(); - WaitFirstFrame(); + NotifyVideoSize(); // Lifetime controlled by object under test. MockGnubbyAuthHandler* gnubby_auth_handler = new MockGnubbyAuthHandler(); @@ -416,7 +411,7 @@ TEST_F(ClientSessionTest, EnableGnubbyAuth) { TEST_F(ClientSessionTest, ResetVideoPipeline) { CreateClientSession(); ConnectClientSession(); - WaitFirstFrame(); + NotifyVideoSize(); client_session_->ResetVideoPipeline(); } @@ -450,6 +445,11 @@ TEST_F(ClientSessionTest, Extensions) { capabilities_message.set_capabilities("cap1 cap4 default"); client_session_->SetCapabilities(capabilities_message); + // Simulate OnCreateVideoEncoder() which is normally called by the + // ConnectionToClient when creating the video stream. + scoped_ptr<VideoEncoder> encoder(new VideoEncoderVerbatim()); + connection_->event_handler()->OnCreateVideoEncoder(&encoder); + // Verify that the correct extension messages are delivered, and dropped. protocol::ExtensionMessage message1; message1.set_type("ext1"); diff --git a/remoting/host/mouse_clamping_filter.cc b/remoting/host/mouse_clamping_filter.cc deleted file mode 100644 index d9c545a..0000000 --- a/remoting/host/mouse_clamping_filter.cc +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "remoting/host/mouse_clamping_filter.h" - -#include "remoting/proto/event.pb.h" -#include "remoting/proto/video.pb.h" - -namespace remoting { - -MouseClampingFilter::MouseClampingFilter( - protocol::InputStub* input_stub) - : input_filter_(input_stub), - video_stub_(nullptr) { -} - -MouseClampingFilter::~MouseClampingFilter() { -} - -void MouseClampingFilter::ProcessVideoPacket( - scoped_ptr<VideoPacket> video_packet, - const base::Closure& done) { - // Configure the MouseInputFilter to clamp to the video dimensions. - if (video_packet->format().has_screen_width() && - video_packet->format().has_screen_height()) { - webrtc::DesktopSize screen_size = - webrtc::DesktopSize(video_packet->format().screen_width(), - video_packet->format().screen_height()); - input_filter_.set_input_size(screen_size); - input_filter_.set_output_size(screen_size); - } - - video_stub_->ProcessVideoPacket(video_packet.Pass(), done); -} - -} // namespace remoting diff --git a/remoting/host/mouse_clamping_filter.h b/remoting/host/mouse_clamping_filter.h deleted file mode 100644 index 994abbe..0000000 --- a/remoting/host/mouse_clamping_filter.h +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef REMOTING_HOST_MOUSE_CLAMPING_FILTER_H_ -#define REMOTING_HOST_MOUSE_CLAMPING_FILTER_H_ - -#include "base/compiler_specific.h" -#include "remoting/protocol/mouse_input_filter.h" -#include "remoting/protocol/video_stub.h" - -namespace remoting { - -// Filtering VideoStub implementation which configures a MouseInputFilter to -// clamp mouse events to fall within the dimensions of the most-recently -// received video frame. -class MouseClampingFilter : public protocol::VideoStub { - public: - explicit MouseClampingFilter(protocol::InputStub* input_stub); - ~MouseClampingFilter() override; - - protocol::InputStub* input_filter() { return &input_filter_; } - - void set_video_stub(protocol::VideoStub* video_stub) { - video_stub_ = video_stub; - } - - // protocol::VideoStub implementation. - void ProcessVideoPacket(scoped_ptr<VideoPacket> video_packet, - const base::Closure& done) override; - - private: - // Clamps mouse event coordinates to the video dimensions. - protocol::MouseInputFilter input_filter_; - - protocol::VideoStub* video_stub_; - - DISALLOW_COPY_AND_ASSIGN(MouseClampingFilter); -}; - -} // namespace remoting - -#endif // REMOTING_HOST_MOUSE_CLAMPING_FILTER_H_ diff --git a/remoting/protocol/connection_to_client.h b/remoting/protocol/connection_to_client.h index 2aac728..966e80d 100644 --- a/remoting/protocol/connection_to_client.h +++ b/remoting/protocol/connection_to_client.h @@ -9,7 +9,14 @@ #include "remoting/protocol/transport.h" +namespace webrtc { +class DesktopCapturer; +} // namespace webrtc + namespace remoting { + +class VideoEncoder; + namespace protocol { class AudioStub; @@ -18,8 +25,7 @@ class ClipboardStub; class HostStub; class InputStub; class Session; -class VideoFeedbackStub; -class VideoStub; +class VideoStream; // This interface represents a remote viewer connection to the chromoting host. // It sets up all protocol channels and connects them to the stubs. @@ -38,6 +44,10 @@ class ConnectionToClient { virtual void OnConnectionChannelsConnected( ConnectionToClient* connection) = 0; + // Called when a VideoEncoder is created. Used by ClientSession to modify + // the video pipeline if necessary. + virtual void OnCreateVideoEncoder(scoped_ptr<VideoEncoder>* encoder) = 0; + // Called when the network connection is closed or failed. virtual void OnConnectionClosed(ConnectionToClient* connection, ErrorCode error) = 0; @@ -74,11 +84,15 @@ class ConnectionToClient { // received event. virtual void OnInputEventReceived(int64_t timestamp) = 0; + // Start video stream that sends screen content from |desktop_capturer| to the + // client. + virtual scoped_ptr<VideoStream> StartVideoStream( + scoped_ptr<webrtc::DesktopCapturer> desktop_capturer) = 0; + // Get the stubs used by the host to transmit messages to the client. // The stubs must not be accessed before OnConnectionAuthenticated(), or // after OnConnectionClosed(). // Note that the audio stub will be nullptr if audio is not enabled. - virtual VideoStub* video_stub() = 0; virtual AudioStub* audio_stub() = 0; virtual ClientStub* client_stub() = 0; @@ -87,11 +101,6 @@ class ConnectionToClient { virtual void set_clipboard_stub(ClipboardStub* clipboard_stub) = 0; virtual void set_host_stub(HostStub* host_stub) = 0; virtual void set_input_stub(InputStub* input_stub) = 0; - - // Sets video feedback stub. Can be called at any time after connection is - // authenticated. - virtual void set_video_feedback_stub( - VideoFeedbackStub* video_feedback_stub) = 0; }; } // namespace protocol diff --git a/remoting/protocol/fake_connection_to_client.cc b/remoting/protocol/fake_connection_to_client.cc index e869278..3caeb55 100644 --- a/remoting/protocol/fake_connection_to_client.cc +++ b/remoting/protocol/fake_connection_to_client.cc @@ -5,10 +5,30 @@ #include "remoting/protocol/fake_connection_to_client.h" #include "remoting/protocol/session.h" +#include "third_party/webrtc/modules/desktop_capture/desktop_capturer.h" namespace remoting { namespace protocol { +FakeVideoStream::FakeVideoStream() : weak_factory_(this) {} +FakeVideoStream::~FakeVideoStream() {} + +void FakeVideoStream::Pause(bool pause) {} + +void FakeVideoStream::OnInputEventReceived(int64_t event_timestamp) {} + +void FakeVideoStream::SetLosslessEncode(bool want_lossless) {} + +void FakeVideoStream::SetLosslessColor(bool want_lossless) {} + +void FakeVideoStream::SetSizeCallback(const SizeCallback& size_callback) { + size_callback_ = size_callback; +} + +base::WeakPtr<FakeVideoStream> FakeVideoStream::GetWeakPtr() { + return weak_factory_.GetWeakPtr(); +} + FakeConnectionToClient::FakeConnectionToClient(scoped_ptr<Session> session) : session_(session.Pass()) {} @@ -18,8 +38,11 @@ void FakeConnectionToClient::SetEventHandler(EventHandler* event_handler) { event_handler_ = event_handler; } -VideoStub* FakeConnectionToClient::video_stub() { - return video_stub_; +scoped_ptr<VideoStream> FakeConnectionToClient::StartVideoStream( + scoped_ptr<webrtc::DesktopCapturer> desktop_capturer) { + scoped_ptr<FakeVideoStream> result(new FakeVideoStream()); + last_video_stream_ = result->GetWeakPtr(); + return result.Pass(); } AudioStub* FakeConnectionToClient::audio_stub() { @@ -57,10 +80,5 @@ void FakeConnectionToClient::set_input_stub(InputStub* input_stub) { input_stub_ = input_stub; } -void FakeConnectionToClient::set_video_feedback_stub( - VideoFeedbackStub* video_feedback_stub) { - video_feedback_stub_ = video_feedback_stub; -} - } // namespace protocol } // namespace remoting diff --git a/remoting/protocol/fake_connection_to_client.h b/remoting/protocol/fake_connection_to_client.h index d389a37..1176a68 100644 --- a/remoting/protocol/fake_connection_to_client.h +++ b/remoting/protocol/fake_connection_to_client.h @@ -5,12 +5,39 @@ #ifndef REMOTING_PROTOCOL_FAKE_CONNECTION_TO_CLIENT_H_ #define REMOTING_PROTOCOL_FAKE_CONNECTION_TO_CLIENT_H_ +#include "base/callback.h" #include "base/macros.h" +#include "base/memory/weak_ptr.h" #include "remoting/protocol/connection_to_client.h" +#include "remoting/protocol/video_stream.h" namespace remoting { namespace protocol { +class FakeVideoStream : public protocol::VideoStream { + public: + FakeVideoStream(); + ~FakeVideoStream() override; + + // protocol::VideoStream interface. + void Pause(bool pause) override; + void OnInputEventReceived(int64_t event_timestamp) override; + void SetLosslessEncode(bool want_lossless) override; + void SetLosslessColor(bool want_lossless) override; + void SetSizeCallback(const SizeCallback& size_callback) override; + + const SizeCallback& size_callback() { return size_callback_; } + + base::WeakPtr<FakeVideoStream> GetWeakPtr(); + + private: + SizeCallback size_callback_; + + base::WeakPtrFactory<FakeVideoStream> weak_factory_; + + DISALLOW_COPY_AND_ASSIGN(FakeVideoStream); +}; + class FakeConnectionToClient : public ConnectionToClient { public: FakeConnectionToClient(scoped_ptr<Session> session); @@ -18,7 +45,9 @@ class FakeConnectionToClient : public ConnectionToClient { void SetEventHandler(EventHandler* event_handler) override; - VideoStub* video_stub() override; + scoped_ptr<VideoStream> StartVideoStream( + scoped_ptr<webrtc::DesktopCapturer> desktop_capturer) override; + AudioStub* audio_stub() override; ClientStub* client_stub() override; void Disconnect(ErrorCode disconnect_error) override; @@ -30,9 +59,10 @@ class FakeConnectionToClient : public ConnectionToClient { void set_host_stub(HostStub* host_stub) override; void set_input_stub(InputStub* input_stub) override; - void set_video_feedback_stub(VideoFeedbackStub* video_feedback_stub) override; + base::WeakPtr<FakeVideoStream> last_video_stream() { + return last_video_stream_; + } - void set_video_stub(VideoStub* video_stub) { video_stub_ = video_stub; } void set_audio_stub(AudioStub* audio_stub) { audio_stub_ = audio_stub; } void set_client_stub(ClientStub* client_stub) { client_stub_ = client_stub; } @@ -41,8 +71,6 @@ class FakeConnectionToClient : public ConnectionToClient { HostStub* host_stub() { return host_stub_; } InputStub* input_stub() { return input_stub_; } - VideoFeedbackStub* video_feedback_stub() { return video_feedback_stub_; } - bool is_connected() { return is_connected_; } ErrorCode disconnect_error() { return disconnect_error_; } @@ -50,14 +78,14 @@ class FakeConnectionToClient : public ConnectionToClient { scoped_ptr<Session> session_; EventHandler* event_handler_ = nullptr; - VideoStub* video_stub_ = nullptr; + base::WeakPtr<FakeVideoStream> last_video_stream_; + AudioStub* audio_stub_ = nullptr; ClientStub* client_stub_ = nullptr; ClipboardStub* clipboard_stub_ = nullptr; HostStub* host_stub_ = nullptr; InputStub* input_stub_ = nullptr; - VideoFeedbackStub* video_feedback_stub_ = nullptr; bool is_connected_ = true; ErrorCode disconnect_error_ = OK; diff --git a/remoting/protocol/ice_connection_to_client.cc b/remoting/protocol/ice_connection_to_client.cc index 5ffd45a..e794987 100644 --- a/remoting/protocol/ice_connection_to_client.cc +++ b/remoting/protocol/ice_connection_to_client.cc @@ -7,6 +7,9 @@ #include "base/bind.h" #include "base/location.h" #include "net/base/io_buffer.h" +#include "remoting/codec/video_encoder.h" +#include "remoting/codec/video_encoder_verbatim.h" +#include "remoting/codec/video_encoder_vpx.h" #include "remoting/protocol/audio_writer.h" #include "remoting/protocol/clipboard_stub.h" #include "remoting/protocol/host_control_dispatcher.h" @@ -14,23 +17,46 @@ #include "remoting/protocol/host_stub.h" #include "remoting/protocol/host_video_dispatcher.h" #include "remoting/protocol/input_stub.h" +#include "remoting/protocol/video_frame_pump.h" namespace remoting { namespace protocol { +namespace { + +scoped_ptr<VideoEncoder> CreateVideoEncoder( + const protocol::SessionConfig& config) { + const protocol::ChannelConfig& video_config = config.video_config(); + + if (video_config.codec == protocol::ChannelConfig::CODEC_VP8) { + return VideoEncoderVpx::CreateForVP8().Pass(); + } else if (video_config.codec == protocol::ChannelConfig::CODEC_VP9) { + return VideoEncoderVpx::CreateForVP9().Pass(); + } else if (video_config.codec == protocol::ChannelConfig::CODEC_VERBATIM) { + return make_scoped_ptr(new VideoEncoderVerbatim()); + } + + NOTREACHED(); + return nullptr; +} + +} // namespace + IceConnectionToClient::IceConnectionToClient( - scoped_ptr<protocol::Session> session) - : handler_(nullptr), session_(session.Pass()) { + scoped_ptr<protocol::Session> session, + scoped_refptr<base::SingleThreadTaskRunner> video_encode_task_runner) + : event_handler_(nullptr), + session_(session.Pass()), + video_encode_task_runner_(video_encode_task_runner) { session_->SetEventHandler(this); } -IceConnectionToClient::~IceConnectionToClient() { -} +IceConnectionToClient::~IceConnectionToClient() {} void IceConnectionToClient::SetEventHandler( ConnectionToClient::EventHandler* event_handler) { DCHECK(thread_checker_.CalledOnValidThread()); - handler_ = event_handler; + event_handler_ = event_handler; } protocol::Session* IceConnectionToClient::session() { @@ -50,12 +76,23 @@ void IceConnectionToClient::Disconnect(ErrorCode error) { void IceConnectionToClient::OnInputEventReceived(int64_t timestamp) { DCHECK(thread_checker_.CalledOnValidThread()); - handler_->OnInputEventReceived(this, timestamp); + event_handler_->OnInputEventReceived(this, timestamp); } -VideoStub* IceConnectionToClient::video_stub() { +scoped_ptr<VideoStream> IceConnectionToClient::StartVideoStream( + scoped_ptr<webrtc::DesktopCapturer> desktop_capturer) { DCHECK(thread_checker_.CalledOnValidThread()); - return video_dispatcher_.get(); + + scoped_ptr<VideoEncoder> video_encoder = + CreateVideoEncoder(session_->config()); + event_handler_->OnCreateVideoEncoder(&video_encoder); + DCHECK(video_encoder); + + scoped_ptr<VideoFramePump> pump( + new VideoFramePump(video_encode_task_runner_, desktop_capturer.Pass(), + video_encoder.Pass(), video_dispatcher_.get())); + video_dispatcher_->set_video_feedback_stub(pump->video_feedback_stub()); + return pump.Pass(); } AudioStub* IceConnectionToClient::audio_stub() { @@ -85,16 +122,10 @@ void IceConnectionToClient::set_input_stub(protocol::InputStub* input_stub) { event_dispatcher_->set_input_stub(input_stub); } -void IceConnectionToClient::set_video_feedback_stub( - VideoFeedbackStub* video_feedback_stub) { - DCHECK(thread_checker_.CalledOnValidThread()); - video_dispatcher_->set_video_feedback_stub(video_feedback_stub); -} - void IceConnectionToClient::OnSessionStateChange(Session::State state) { DCHECK(thread_checker_.CalledOnValidThread()); - DCHECK(handler_); + DCHECK(event_handler_); switch (state) { case Session::INITIALIZING: case Session::CONNECTING: @@ -104,7 +135,7 @@ void IceConnectionToClient::OnSessionStateChange(Session::State state) { // Don't care about these events. break; case Session::AUTHENTICATING: - handler_->OnConnectionAuthenticating(this); + event_handler_->OnConnectionAuthenticating(this); break; case Session::AUTHENTICATED: // Initialize channels. @@ -131,7 +162,7 @@ void IceConnectionToClient::OnSessionStateChange(Session::State state) { // Notify the handler after initializing the channels, so that // ClientSession can get a client clipboard stub. - handler_->OnConnectionAuthenticated(this); + event_handler_->OnConnectionAuthenticated(this); break; case Session::CLOSED: @@ -147,7 +178,7 @@ void IceConnectionToClient::OnSessionStateChange(Session::State state) { void IceConnectionToClient::OnSessionRouteChange( const std::string& channel_name, const TransportRoute& route) { - handler_->OnRouteChange(this, channel_name, route); + event_handler_->OnRouteChange(this, channel_name, route); } void IceConnectionToClient::OnChannelInitialized( @@ -180,12 +211,12 @@ void IceConnectionToClient::NotifyIfChannelsReady() { session_->config().is_audio_enabled()) { return; } - handler_->OnConnectionChannelsConnected(this); + event_handler_->OnConnectionChannelsConnected(this); } void IceConnectionToClient::Close(ErrorCode error) { CloseChannels(); - handler_->OnConnectionClosed(this, error); + event_handler_->OnConnectionClosed(this, error); } void IceConnectionToClient::CloseChannels() { diff --git a/remoting/protocol/ice_connection_to_client.h b/remoting/protocol/ice_connection_to_client.h index fa07627..8387b94 100644 --- a/remoting/protocol/ice_connection_to_client.h +++ b/remoting/protocol/ice_connection_to_client.h @@ -22,6 +22,7 @@ class HostControlDispatcher; class HostEventDispatcher; class HostVideoDispatcher; class VideoFeedbackStub; +class VideoFramePump; // This class represents a remote viewer connection to the chromoting // host. It sets up all protocol channels and connects them to the @@ -30,7 +31,9 @@ class IceConnectionToClient : public ConnectionToClient, public Session::EventHandler, public ChannelDispatcherBase::EventHandler { public: - explicit IceConnectionToClient(scoped_ptr<Session> session); + IceConnectionToClient( + scoped_ptr<Session> session, + scoped_refptr<base::SingleThreadTaskRunner> video_encode_task_runner); ~IceConnectionToClient() override; // ConnectionToClient interface. @@ -39,13 +42,13 @@ class IceConnectionToClient : public ConnectionToClient, Session* session() override; void Disconnect(ErrorCode error) override; void OnInputEventReceived(int64_t timestamp) override; - VideoStub* video_stub() override; + scoped_ptr<VideoStream> StartVideoStream( + scoped_ptr<webrtc::DesktopCapturer> desktop_capturer) override; AudioStub* audio_stub() override; ClientStub* client_stub() override; void set_clipboard_stub(ClipboardStub* clipboard_stub) override; void set_host_stub(HostStub* host_stub) override; void set_input_stub(InputStub* input_stub) override; - void set_video_feedback_stub(VideoFeedbackStub* video_feedback_stub) override; // Session::EventHandler interface. void OnSessionStateChange(Session::State state) override; @@ -68,11 +71,13 @@ class IceConnectionToClient : public ConnectionToClient, base::ThreadChecker thread_checker_; // Event handler for handling events sent from this object. - ConnectionToClient::EventHandler* handler_; + ConnectionToClient::EventHandler* event_handler_; // The libjingle channel used to send and receive data from the remote client. scoped_ptr<Session> session_; + scoped_refptr<base::SingleThreadTaskRunner> video_encode_task_runner_; + scoped_ptr<HostControlDispatcher> control_dispatcher_; scoped_ptr<HostEventDispatcher> event_dispatcher_; scoped_ptr<HostVideoDispatcher> video_dispatcher_; diff --git a/remoting/protocol/ice_connection_to_client_unittest.cc b/remoting/protocol/ice_connection_to_client_unittest.cc index 5daecee..b6a860b 100644 --- a/remoting/protocol/ice_connection_to_client_unittest.cc +++ b/remoting/protocol/ice_connection_to_client_unittest.cc @@ -29,7 +29,8 @@ class IpcConnectionToClientTest : public testing::Test { session_ = new FakeSession(); // Allocate a ClientConnection object with the mock objects. - viewer_.reset(new IceConnectionToClient(make_scoped_ptr(session_))); + viewer_.reset(new IceConnectionToClient(make_scoped_ptr(session_), + message_loop_.task_runner())); viewer_->SetEventHandler(&handler_); EXPECT_CALL(handler_, OnConnectionAuthenticated(viewer_.get())) .WillOnce( @@ -65,8 +66,8 @@ class IpcConnectionToClientTest : public testing::Test { }; TEST_F(IpcConnectionToClientTest, SendUpdateStream) { - scoped_ptr<VideoPacket> packet(new VideoPacket()); - viewer_->video_stub()->ProcessVideoPacket(packet.Pass(), base::Closure()); + Capabilities capabilities; + viewer_->client_stub()->SetCapabilities(capabilities); base::RunLoop().RunUntilIdle(); @@ -74,7 +75,7 @@ TEST_F(IpcConnectionToClientTest, SendUpdateStream) { // TODO(sergeyu): Verify that the correct data has been written. FakeStreamSocket* channel = session_->GetTransport()->GetStreamChannelFactory()->GetFakeChannel( - kVideoChannelName); + kControlChannelName); ASSERT_TRUE(channel); EXPECT_FALSE(channel->written_data().empty()); @@ -85,8 +86,8 @@ TEST_F(IpcConnectionToClientTest, SendUpdateStream) { } TEST_F(IpcConnectionToClientTest, NoWriteAfterDisconnect) { - scoped_ptr<VideoPacket> packet(new VideoPacket()); - viewer_->video_stub()->ProcessVideoPacket(packet.Pass(), base::Closure()); + Capabilities capabilities; + viewer_->client_stub()->SetCapabilities(capabilities); // And then close the connection to ConnectionToClient. viewer_->Disconnect(protocol::OK); diff --git a/remoting/protocol/protocol_mock_objects.cc b/remoting/protocol/protocol_mock_objects.cc index 1564088..fc6a3d5 100644 --- a/remoting/protocol/protocol_mock_objects.cc +++ b/remoting/protocol/protocol_mock_objects.cc @@ -6,6 +6,7 @@ #include "base/logging.h" #include "base/thread_task_runner_handle.h" +#include "remoting/protocol/video_stream.h" namespace remoting { namespace protocol { diff --git a/remoting/protocol/protocol_mock_objects.h b/remoting/protocol/protocol_mock_objects.h index a87c743..d811790 100644 --- a/remoting/protocol/protocol_mock_objects.h +++ b/remoting/protocol/protocol_mock_objects.h @@ -43,6 +43,7 @@ class MockConnectionToClientEventHandler void(ConnectionToClient* connection)); MOCK_METHOD2(OnConnectionClosed, void(ConnectionToClient* connection, ErrorCode error)); + MOCK_METHOD1(OnCreateVideoEncoder, void(scoped_ptr<VideoEncoder>* encoder)); MOCK_METHOD2(OnInputEventReceived, void(ConnectionToClient* connection, int64_t timestamp)); MOCK_METHOD3(OnRouteChange, diff --git a/remoting/protocol/video_frame_pump.cc b/remoting/protocol/video_frame_pump.cc index 8e286de..9bd878f 100644 --- a/remoting/protocol/video_frame_pump.cc +++ b/remoting/protocol/video_frame_pump.cc @@ -104,6 +104,11 @@ void VideoFramePump::SetLosslessColor(bool want_lossless) { base::Unretained(encoder_.get()), want_lossless)); } +void VideoFramePump::SetSizeCallback(const SizeCallback& size_callback) { + DCHECK(thread_checker_.CalledOnValidThread()); + size_callback_ = size_callback; +} + webrtc::SharedMemory* VideoFramePump::CreateSharedMemory(size_t size) { DCHECK(thread_checker_.CalledOnValidThread()); return nullptr; @@ -116,6 +121,12 @@ void VideoFramePump::OnCaptureCompleted(webrtc::DesktopFrame* frame) { captured_frame_timestamps_->capture_ended_time = base::TimeTicks::Now(); + if (frame && !frame_size_.equals(frame->size())) { + frame_size_ = frame->size(); + if (!size_callback_.is_null()) + size_callback_.Run(frame_size_); + } + // Even when |frame| is nullptr we still need to post it to the encode thread // to make sure frames are freed in the same order they are received and // that we don't start capturing frame n+2 before frame n is freed. diff --git a/remoting/protocol/video_frame_pump.h b/remoting/protocol/video_frame_pump.h index 1974ec6..b2af08c 100644 --- a/remoting/protocol/video_frame_pump.h +++ b/remoting/protocol/video_frame_pump.h @@ -6,7 +6,6 @@ #define REMOTING_PROTOCOL_VIDEO_FRAME_PUMP_H_ #include "base/basictypes.h" -#include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" #include "base/memory/scoped_vector.h" #include "base/threading/thread_checker.h" @@ -15,6 +14,7 @@ #include "remoting/codec/video_encoder.h" #include "remoting/proto/video.pb.h" #include "remoting/protocol/capture_scheduler.h" +#include "remoting/protocol/video_stream.h" #include "third_party/webrtc/modules/desktop_capture/desktop_capturer.h" namespace base { @@ -63,7 +63,8 @@ class VideoStub; // of the capture, encode and network processes. However, it also needs to // rate-limit captures to avoid overloading the host system, either by consuming // too much CPU, or hogging the host's graphics subsystem. -class VideoFramePump : public webrtc::DesktopCapturer::Callback { +class VideoFramePump : public VideoStream, + public webrtc::DesktopCapturer::Callback { public: // Enables timestamps for generated frames. Used for testing. static void EnableTimestampsForTests(); @@ -78,17 +79,12 @@ class VideoFramePump : public webrtc::DesktopCapturer::Callback { protocol::VideoStub* video_stub); ~VideoFramePump() override; - // Pauses or resumes scheduling of frame captures. Pausing/resuming captures - // only affects capture scheduling and does not stop/start the capturer. - void Pause(bool pause); - - // Called whenever input event is received. - void OnInputEventReceived(int64_t event_timestamp); - - // Sets whether the video encoder should be requested to encode losslessly, - // or to use a lossless color space (typically requiring higher bandwidth). - void SetLosslessEncode(bool want_lossless); - void SetLosslessColor(bool want_lossless); + // VideoStream interface. + void Pause(bool pause) override; + void OnInputEventReceived(int64_t event_timestamp) override; + void SetLosslessEncode(bool want_lossless) override; + void SetLosslessColor(bool want_lossless) override; + void SetSizeCallback(const SizeCallback& size_callback) override; protocol::VideoFeedbackStub* video_feedback_stub() { return &capture_scheduler_; @@ -166,6 +162,9 @@ class VideoFramePump : public webrtc::DesktopCapturer::Callback { // Interface through which video frames are passed to the client. protocol::VideoStub* video_stub_; + SizeCallback size_callback_; + webrtc::DesktopSize frame_size_; + // Timer used to ensure that we send empty keep-alive frames to the client // even when the video stream is paused or encoder is busy. base::Timer keep_alive_timer_; diff --git a/remoting/protocol/video_stream.h b/remoting/protocol/video_stream.h new file mode 100644 index 0000000..000a1f2 --- /dev/null +++ b/remoting/protocol/video_stream.h @@ -0,0 +1,44 @@ +// Copyright 2015 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef REMOTING_PROTOCOL_VIDEO_STREAM_H_ +#define REMOTING_PROTOCOL_VIDEO_STREAM_H_ + +#include "base/callback_forward.h" + +namespace webrtc { +class DesktopSize; +} // namespace webrtc + +namespace remoting { +namespace protocol { + +class VideoStream { + public: + // Callback used to notify about screen size changes. + typedef base::Callback<void(const webrtc::DesktopSize& size)> SizeCallback; + + VideoStream() {} + virtual ~VideoStream() {} + + // Pauses or resumes scheduling of frame captures. Pausing/resuming captures + // only affects capture scheduling and does not stop/start the capturer. + virtual void Pause(bool pause) = 0; + + // Should be called whenever an input event is received. + virtual void OnInputEventReceived(int64_t event_timestamp) = 0; + + // Sets whether the video encoder should be requested to encode losslessly, + // or to use a lossless color space (typically requiring higher bandwidth). + virtual void SetLosslessEncode(bool want_lossless) = 0; + virtual void SetLosslessColor(bool want_lossless) = 0; + + // Sets SizeCallback to be called when screen size is changed. + virtual void SetSizeCallback(const SizeCallback& size_callback) = 0; +}; + +} // namespace protocol +} // namespace remoting + +#endif // REMOTING_PROTOCOL_VIDEO_STREAM_H_ diff --git a/remoting/remoting_host_srcs.gypi b/remoting/remoting_host_srcs.gypi index f806865..6df087a 100644 --- a/remoting/remoting_host_srcs.gypi +++ b/remoting/remoting_host_srcs.gypi @@ -182,8 +182,6 @@ 'host/logging_win.cc', 'host/me2me_desktop_environment.cc', 'host/me2me_desktop_environment.h', - 'host/mouse_clamping_filter.cc', - 'host/mouse_clamping_filter.h', 'host/mouse_shape_pump.cc', 'host/mouse_shape_pump.h', 'host/oauth_token_getter.cc', diff --git a/remoting/remoting_srcs.gypi b/remoting/remoting_srcs.gypi index faf4efb..69f9bbc 100644 --- a/remoting/remoting_srcs.gypi +++ b/remoting/remoting_srcs.gypi @@ -116,8 +116,6 @@ 'protocol/host_stub.h', 'protocol/host_video_dispatcher.cc', 'protocol/host_video_dispatcher.h', - 'protocol/ice_connection_to_client.cc', - 'protocol/ice_connection_to_client.h', 'protocol/ice_transport_channel.cc', 'protocol/ice_transport_channel.h', 'protocol/ice_transport_factory.cc', @@ -214,6 +212,8 @@ 'protocol/chromium_port_allocator_factory.h', 'protocol/chromium_socket_factory.cc', 'protocol/chromium_socket_factory.h', + 'protocol/ice_connection_to_client.cc', + 'protocol/ice_connection_to_client.h', 'protocol/video_frame_pump.cc', 'protocol/video_frame_pump.h', 'protocol/webrtc_transport.cc', |