Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(156)

Unified Diff: remoting/host/client_session.cc

Issue 10909143: Revert 155574 - [Chromoting] Refactoring DesktopEnvironment and moving screen/audio recorders to Cl… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « remoting/host/client_session.h ('k') | remoting/host/client_session_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/host/client_session.cc
===================================================================
--- remoting/host/client_session.cc (revision 155615)
+++ remoting/host/client_session.cc (working copy)
@@ -7,16 +7,6 @@
#include <algorithm>
#include "base/message_loop_proxy.h"
-#include "remoting/codec/audio_encoder.h"
-#include "remoting/codec/audio_encoder_speex.h"
-#include "remoting/codec/audio_encoder_verbatim.h"
-#include "remoting/codec/video_encoder.h"
-#include "remoting/codec/video_encoder_row_based.h"
-#include "remoting/codec/video_encoder_vp8.h"
-#include "remoting/host/audio_scheduler.h"
-#include "remoting/host/desktop_environment.h"
-#include "remoting/host/event_executor.h"
-#include "remoting/host/screen_recorder.h"
#include "remoting/host/video_frame_capturer.h"
#include "remoting/proto/control.pb.h"
#include "remoting/proto/event.pb.h"
@@ -27,32 +17,26 @@
ClientSession::ClientSession(
EventHandler* event_handler,
- scoped_refptr<base::SingleThreadTaskRunner> capture_task_runner,
- scoped_refptr<base::SingleThreadTaskRunner> encode_task_runner,
- scoped_refptr<base::SingleThreadTaskRunner> network_task_runner,
scoped_ptr<protocol::ConnectionToClient> connection,
- scoped_ptr<DesktopEnvironment> desktop_environment,
+ protocol::ClipboardStub* host_clipboard_stub,
+ protocol::InputStub* host_input_stub,
+ VideoFrameCapturer* capturer,
const base::TimeDelta& max_duration)
: event_handler_(event_handler),
connection_(connection.Pass()),
- desktop_environment_(desktop_environment.Pass()),
client_jid_(connection_->session()->jid()),
- host_clipboard_stub_(desktop_environment_->event_executor()),
- host_input_stub_(desktop_environment_->event_executor()),
+ host_clipboard_stub_(host_clipboard_stub),
+ host_input_stub_(host_input_stub),
input_tracker_(host_input_stub_),
remote_input_filter_(&input_tracker_),
- mouse_clamping_filter_(desktop_environment_->video_capturer(),
- &remote_input_filter_),
+ mouse_clamping_filter_(capturer, &remote_input_filter_),
disable_input_filter_(&mouse_clamping_filter_),
disable_clipboard_filter_(clipboard_echo_filter_.host_filter()),
auth_input_filter_(&disable_input_filter_),
auth_clipboard_filter_(&disable_clipboard_filter_),
client_clipboard_factory_(clipboard_echo_filter_.client_filter()),
- max_duration_(max_duration),
- capture_task_runner_(capture_task_runner),
- encode_task_runner_(encode_task_runner),
- network_task_runner_(network_task_runner),
- active_recorders_(0) {
+ capturer_(capturer),
+ max_duration_(max_duration) {
connection_->SetEventHandler(this);
// TODO(sergeyu): Currently ConnectionToClient expects stubs to be
@@ -68,6 +52,9 @@
auth_clipboard_filter_.set_enabled(false);
}
+ClientSession::~ClientSession() {
+}
+
void ClientSession::NotifyClientDimensions(
const protocol::ClientDimensions& dimensions) {
// TODO(wez): Use the dimensions, e.g. to resize the host desktop to match.
@@ -111,34 +98,6 @@
DCHECK(CalledOnValidThread());
DCHECK_EQ(connection_.get(), connection);
SetDisableInputs(false);
-
- // Create a ScreenRecorder, passing the message loops that it should run on.
- VideoEncoder* video_encoder =
- CreateVideoEncoder(connection_->session()->config());
- video_recorder_ = new ScreenRecorder(capture_task_runner_,
- encode_task_runner_,
- network_task_runner_,
- desktop_environment_->video_capturer(),
- video_encoder);
- ++active_recorders_;
-
- if (connection_->session()->config().is_audio_enabled()) {
- scoped_ptr<AudioEncoder> audio_encoder =
- CreateAudioEncoder(connection_->session()->config());
- audio_scheduler_ = new AudioScheduler(
- capture_task_runner_,
- network_task_runner_,
- desktop_environment_->audio_capturer(),
- audio_encoder.Pass(),
- connection_->audio_stub());
- ++active_recorders_;
- }
-
- // Start the session.
- video_recorder_->AddConnection(connection_.get());
- video_recorder_->Start();
- desktop_environment_->Start(CreateClipboardProxy());
-
event_handler_->OnSessionChannelsConnected(this);
}
@@ -168,10 +127,6 @@
protocol::ConnectionToClient* connection, int64 sequence_number) {
DCHECK(CalledOnValidThread());
DCHECK_EQ(connection_.get(), connection);
-
- if (video_recorder_.get())
- video_recorder_->UpdateSequenceNumber(sequence_number);
-
event_handler_->OnSessionSequenceNumber(this, sequence_number);
}
@@ -194,32 +149,6 @@
connection_->Disconnect();
}
-void ClientSession::StopAndDelete(const base::Closure& done_task) {
- DCHECK(CalledOnValidThread());
- DCHECK(done_task_.is_null());
-
- done_task_ = done_task;
- if (audio_scheduler_.get()) {
- audio_scheduler_->OnClientDisconnected();
- audio_scheduler_->Stop(base::Bind(&ClientSession::OnRecorderStopped,
- base::Unretained(this)));
- audio_scheduler_ = NULL;
- }
-
- if (video_recorder_.get()) {
- video_recorder_->RemoveConnection(connection_.get());
- video_recorder_->Stop(base::Bind(&ClientSession::OnRecorderStopped,
- base::Unretained(this)));
- video_recorder_ = NULL;
- }
-
- if (!active_recorders_) {
- base::Closure done_task = done_task_;
- delete this;
- done_task.Run();
- }
-}
-
void ClientSession::LocalMouseMoved(const SkIPoint& mouse_pos) {
DCHECK(CalledOnValidThread());
remote_input_filter_.LocalMouseMoved(mouse_pos);
@@ -235,11 +164,6 @@
disable_clipboard_filter_.set_enabled(!disable_inputs);
}
-ClientSession::~ClientSession() {
- DCHECK(audio_scheduler_.get() == NULL);
- DCHECK(video_recorder_.get() == NULL);
-}
-
scoped_ptr<protocol::ClipboardStub> ClientSession::CreateClipboardProxy() {
DCHECK(CalledOnValidThread());
@@ -249,57 +173,4 @@
base::MessageLoopProxy::current()));
}
-void ClientSession::OnRecorderStopped() {
- if (!network_task_runner_->BelongsToCurrentThread()) {
- network_task_runner_->PostTask(
- FROM_HERE, base::Bind(&ClientSession::OnRecorderStopped,
- base::Unretained(this)));
- return;
- }
-
- DCHECK(!done_task_.is_null());
-
- --active_recorders_;
- DCHECK_GE(active_recorders_, 0);
-
- if (!active_recorders_) {
- base::Closure done_task = done_task_;
- delete this;
- done_task.Run();
- }
-}
-
-// TODO(sergeyu): Move this to SessionManager?
-// static
-VideoEncoder* ClientSession::CreateVideoEncoder(
- const protocol::SessionConfig& config) {
- const protocol::ChannelConfig& video_config = config.video_config();
-
- if (video_config.codec == protocol::ChannelConfig::CODEC_VERBATIM) {
- return VideoEncoderRowBased::CreateVerbatimEncoder();
- } else if (video_config.codec == protocol::ChannelConfig::CODEC_ZIP) {
- return VideoEncoderRowBased::CreateZlibEncoder();
- } else if (video_config.codec == protocol::ChannelConfig::CODEC_VP8) {
- return new remoting::VideoEncoderVp8();
- }
-
- NOTIMPLEMENTED();
- return NULL;
-}
-
-// static
-scoped_ptr<AudioEncoder> ClientSession::CreateAudioEncoder(
- const protocol::SessionConfig& config) {
- const protocol::ChannelConfig& audio_config = config.audio_config();
-
- if (audio_config.codec == protocol::ChannelConfig::CODEC_VERBATIM) {
- return scoped_ptr<AudioEncoder>(new AudioEncoderVerbatim());
- } else if (audio_config.codec == protocol::ChannelConfig::CODEC_SPEEX) {
- return scoped_ptr<AudioEncoder>(new AudioEncoderSpeex());
- }
-
- NOTIMPLEMENTED();
- return scoped_ptr<AudioEncoder>(NULL);
-}
-
} // namespace remoting
« no previous file with comments | « remoting/host/client_session.h ('k') | remoting/host/client_session_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698