Author: serg
...@chromium.org
Date: Tue Nov 13 20:11:19 2012
New Revision: 167591
Log:
Rename capture and encode threads to make it clear that they are for video.
Renamed capture thread to video_capture thread and encode thread to video_encode thread. It's
mainly to prevent bugs like crbug.com/157992
Review URL: https://chromiumcodereview.appspot.com/11366226
Modified:
trunk/src/remoting/host/chromoting_host.cc
trunk/src/remoting/host/chromoting_host.h
trunk/src/remoting/host/chromoting_host_context.cc
trunk/src/remoting/host/chromoting_host_context.h
trunk/src/remoting/host/chromoting_host_context_unittest.cc
trunk/src/remoting/host/client_session.cc
trunk/src/remoting/host/client_session.h
trunk/src/remoting/host/plugin/host_script_object.cc
trunk/src/remoting/host/remoting_me2me_host.cc
Modified: trunk/src/remoting/host/chromoting_host.cc
=========================================================================== ===
--- trunk/src/remoting/host/chromoting_host.cc (original)
+++ trunk/src/remoting/host/chromoting_host.cc Tue Nov 13 20:11:19 2012
@@ -60,14 +60,14 @@
DesktopEnvironmentFactory* desktop_environment_factory,
scoped_ptr<protocol::SessionManager> session_manager,
scoped_refptr<base::SingleThreadTaskRunner> audio_task_runner,
- scoped_refptr<base::SingleThreadTaskRunner> capture_task_runner,
- scoped_refptr<base::SingleThreadTaskRunner> encode_task_runner,
+ scoped_refptr<base::SingleThreadTaskRunner> video_capture_task_runner,
+ scoped_refptr<base::SingleThreadTaskRunner> video_encode_task_runner,
scoped_refptr<base::SingleThreadTaskRunner> network_task_runner)
: desktop_environment_factory_(desktop_environment_factory),
session_manager_(session_manager.Pass()),
audio_task_runner_(audio_task_runner),
- capture_task_runner_(capture_task_runner),
- encode_task_runner_(encode_task_runner),
+ video_capture_task_runner_(video_capture_task_runner),
+ video_encode_task_runner_(video_encode_task_runner),
network_task_runner_(network_task_runner),
signal_strategy_(signal_strategy),
clients_count_(0),
@@ -314,8 +314,8 @@
scoped_refptr<ClientSession> client = new ClientSession(
this,
audio_task_runner_,
- capture_task_runner_,
- encode_task_runner_,
+ video_capture_task_runner_,
+ video_encode_task_runner_,
network_task_runner_,
connection.Pass(),
desktop_environment_factory_,
Modified: trunk/src/remoting/host/chromoting_host.h
=========================================================================== ===
--- trunk/src/remoting/host/chromoting_host.h (original)
+++ trunk/src/remoting/host/chromoting_host.h Tue Nov 13 20:11:19 2012
@@ -73,8 +73,8 @@
DesktopEnvironmentFactory* desktop_environment_factory,
scoped_ptr<protocol::SessionManager> session_manager,
scoped_refptr<base::SingleThreadTaskRunner> audio_task_runner,
- scoped_refptr<base::SingleThreadTaskRunner> capture_task_runner,
- scoped_refptr<base::SingleThreadTaskRunner> encode_task_runner,
+ scoped_refptr<base::SingleThreadTaskRunner> video_capture_task_runner,
+ scoped_refptr<base::SingleThreadTaskRunner> video_encode_task_runner,
scoped_refptr<base::SingleThreadTaskRunner> network_task_runner);
// Asynchronously start the host process.
@@ -185,8 +185,8 @@
DesktopEnvironmentFactory* desktop_environment_factory_;
scoped_ptr<protocol::SessionManager> session_manager_;
scoped_refptr<base::SingleThreadTaskRunner> audio_task_runner_;
- scoped_refptr<base::SingleThreadTaskRunner> capture_task_runner_;
- scoped_refptr<base::SingleThreadTaskRunner> encode_task_runner_;
+ scoped_refptr<base::SingleThreadTaskRunner> video_capture_task_runner_;
+ scoped_refptr<base::SingleThreadTaskRunner> video_encode_task_runner_;
scoped_refptr<base::SingleThreadTaskRunner> network_task_runner_;
// Connection objects.
Modified: trunk/src/remoting/host/chromoting_host_context.cc
=========================================================================== ===
--- trunk/src/remoting/host/chromoting_host_context.cc (original)
+++ trunk/src/remoting/host/chromoting_host_context.cc Tue Nov 13 20:11:19 2012
@@ -16,8 +16,8 @@
ChromotingHostContext::ChromotingHostContext(
scoped_refptr<AutoThreadTaskRunner> ui_task_runner)
: audio_thread_("ChromotingAudioThread"),
- capture_thread_("ChromotingCaptureThread"),
- encode_thread_("ChromotingEncodeThread"),
+ video_capture_thread_("ChromotingCaptureThread"),
+ video_encode_thread_("ChromotingEncodeThread"),
file_thread_("ChromotingFileIOThread"),
input_thread_("ChromotingInputThread"),
network_thread_("ChromotingNetworkThread"),
@@ -30,8 +30,8 @@
void ChromotingHostContext::ReleaseTaskRunners() {
url_request_context_getter_ = NULL;
audio_task_runner_ = NULL;
- capture_task_runner_ = NULL;
- encode_task_runner_ = NULL;
+ video_capture_task_runner_ = NULL;
+ video_encode_task_runner_ = NULL;
file_task_runner_ = NULL;
input_task_runner_ = NULL;
network_task_runner_ = NULL;
@@ -42,7 +42,7 @@
// Start all the threads.
base::Thread::Options io_thread_options(MessageLoop::TYPE_IO, 0);
- bool started = capture_thread_.Start() && encode_thread_.Start();
+ bool started = video_capture_thread_.Start() && video_encode_thread_.Start();
#if defined(OS_WIN)
// On Windows audio capturer needs to run on a UI thread that has COM
@@ -66,11 +66,11 @@
audio_task_runner_ =
new AutoThreadTaskRunner(audio_thread_.message_loop_proxy(),
ui_task_runner_);
- capture_task_runner_ =
- new AutoThreadTaskRunner(capture_thread_.message_loop_proxy(),
+ video_capture_task_runner_ =
+ new AutoThreadTaskRunner(video_capture_thread_.message_loop_proxy(),
ui_task_runner_);
- encode_task_runner_ =
- new AutoThreadTaskRunner(encode_thread_.message_loop_proxy(),
+ video_encode_task_runner_ =
+ new AutoThreadTaskRunner(video_encode_thread_.message_loop_proxy(),
ui_task_runner_);
file_task_runner_ =
new AutoThreadTaskRunner(file_thread_.message_loop_proxy(),
@@ -91,12 +91,14 @@
return audio_task_runner_;
}
-base::SingleThreadTaskRunner* ChromotingHostContext::capture_task_runner() {
- return capture_task_runner_;
+base::SingleThreadTaskRunner*
+ChromotingHostContext::video_capture_task_runner() {
+ return video_capture_task_runner_;
}
-base::SingleThreadTaskRunner* ChromotingHostContext::encode_task_runner() {
- return encode_task_runner_;
+base::SingleThreadTaskRunner*
+ChromotingHostContext::video_encode_task_runner() {
+ return video_encode_task_runner_;
}
base::SingleThreadTaskRunner* ChromotingHostContext::file_task_runner() {
Modified: trunk/src/remoting/host/chromoting_host_context.h
=========================================================================== ===
--- trunk/src/remoting/host/chromoting_host_context.h (original)
+++ trunk/src/remoting/host/chromoting_host_context.h Tue Nov 13 20:11:19 2012
@@ -44,10 +44,10 @@
// Task runner for the thread used by the ScreenRecorder to capture
// the screen.
- virtual base::SingleThreadTaskRunner* capture_task_runner();
+ virtual base::SingleThreadTaskRunner* video_capture_task_runner();
// Task runner for the thread used to encode video streams.
- virtual base::SingleThreadTaskRunner* encode_task_runner();
+ virtual base::SingleThreadTaskRunner* video_encode_task_runner();
// Task runner for the thread that is used for blocking file
// IO. This thread is used by the URLRequestContext to read proxy
@@ -79,10 +79,10 @@
base::Thread audio_thread_;
// A thread that hosts screen capture.
- base::Thread capture_thread_;
+ base::Thread video_capture_thread_;
- // A thread that hosts all encode operations.
- base::Thread encode_thread_;
+ // A thread that hosts video encode operations.
+ base::Thread video_encode_thread_;
// Thread for blocking IO operations.
base::Thread file_thread_;
@@ -96,8 +96,8 @@
// Task runners wrapping the above threads. These should be declared after
// the corresponding threads to guarantee proper order of destruction.
scoped_refptr<base::SingleThreadTaskRunner> audio_task_runner_;
- scoped_refptr<base::SingleThreadTaskRunner> capture_task_runner_;
- scoped_refptr<base::SingleThreadTaskRunner> encode_task_runner_;
+ scoped_refptr<base::SingleThreadTaskRunner> video_capture_task_runner_;
+ scoped_refptr<base::SingleThreadTaskRunner> video_encode_task_runner_;
scoped_refptr<base::SingleThreadTaskRunner> file_task_runner_;
scoped_refptr<base::SingleThreadTaskRunner> input_task_runner_;
scoped_refptr<base::SingleThreadTaskRunner> network_task_runner_;
Modified: trunk/src/remoting/host/chromoting_host_context_unittest.cc
=========================================================================== ===
--- trunk/src/remoting/host/chromoting_host_context_unittest.cc (original)
+++ trunk/src/remoting/host/chromoting_host_context_unittest.cc Tue Nov 13 20:11:19 2012
@@ -19,8 +19,8 @@
context.Start();
EXPECT_TRUE(context.audio_task_runner());
- EXPECT_TRUE(context.capture_task_runner());
- EXPECT_TRUE(context.encode_task_runner());
+ EXPECT_TRUE(context.video_capture_task_runner());
+ EXPECT_TRUE(context.video_encode_task_runner());
EXPECT_TRUE(context.file_task_runner());
EXPECT_TRUE(context.input_task_runner());
EXPECT_TRUE(context.network_task_runner());
Modified: trunk/src/remoting/host/client_session.cc
=========================================================================== ===
--- trunk/src/remoting/host/client_session.cc (original)
+++ trunk/src/remoting/host/client_session.cc Tue Nov 13 20:11:19 2012
@@ -30,8 +30,8 @@
ClientSession::ClientSession(
EventHandler* event_handler,
scoped_refptr<base::SingleThreadTaskRunner> audio_task_runner,
- scoped_refptr<base::SingleThreadTaskRunner> capture_task_runner,
- scoped_refptr<base::SingleThreadTaskRunner> encode_task_runner,
+ scoped_refptr<base::SingleThreadTaskRunner> video_capture_task_runner,
+ scoped_refptr<base::SingleThreadTaskRunner> video_encode_task_runner,
scoped_refptr<base::SingleThreadTaskRunner> network_task_runner,
scoped_ptr<protocol::ConnectionToClient> connection,
DesktopEnvironmentFactory* desktop_environment_factory,
@@ -54,8 +54,8 @@
client_clipboard_factory_(clipboard_echo_filter_.client_filter()),
max_duration_(max_duration),
audio_task_runner_(audio_task_runner),
- capture_task_runner_(capture_task_runner),
- encode_task_runner_(encode_task_runner),
+ video_capture_task_runner_(video_capture_task_runner),
+ video_encode_task_runner_(video_encode_task_runner),
network_task_runner_(network_task_runner),
active_recorders_(0) {
connection_->SetEventHandler(this);
@@ -134,8 +134,8 @@
CreateVideoEncoder(connection_->session()->config());
// Create a VideoScheduler to pump frames from the capturer to the client.
- video_scheduler_ = new VideoScheduler(capture_task_runner_,
- encode_task_runner_,
+ video_scheduler_ = new VideoScheduler(video_capture_task_runner_,
+ video_encode_task_runner_,
network_task_runner_,
desktop_environment_->video_capturer(),
video_encoder.Pass(),
Modified: trunk/src/remoting/host/client_session.h
=========================================================================== ===
--- trunk/src/remoting/host/client_session.h (original)
+++ trunk/src/remoting/host/client_session.h Tue Nov 13 20:11:19 2012
@@ -88,14 +88,15 @@
// |event_handler| must outlive |this|. |desktop_environment_factory| is only
// used by the constructor to create an instance of DesktopEnvironment.
- ClientSession(EventHandler* event_handler,
- scoped_refptr<base::SingleThreadTaskRunner> audio_task_runner,
- 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,
- DesktopEnvironmentFactory* desktop_environment_factory,
- const base::TimeDelta& max_duration);
+ ClientSession(
+ EventHandler* event_handler,
+ scoped_refptr<base::SingleThreadTaskRunner> audio_task_runner,
+ scoped_refptr<base::SingleThreadTaskRunner> video_capture_task_runner,
+ scoped_refptr<base::SingleThreadTaskRunner> video_encode_task_runner,
+ scoped_refptr<base::SingleThreadTaskRunner> network_task_runner,
+ scoped_ptr<protocol::ConnectionToClient> connection,
+ DesktopEnvironmentFactory* desktop_environment_factory,
+ const base::TimeDelta& max_duration);
// protocol::HostStub interface.
virtual void NotifyClientDimensions(
@@ -217,9 +218,10 @@
// is reached.
base::OneShotTimer<ClientSession> max_duration_timer_;
+
scoped_refptr<base::SingleThreadTaskRunner> audio_task_runner_;
- scoped_refptr<base::SingleThreadTaskRunner> capture_task_runner_;
- scoped_refptr<base::SingleThreadTaskRunner> encode_task_runner_;
+ scoped_refptr<base::SingleThreadTaskRunner> video_capture_task_runner_;
+ scoped_refptr<base::SingleThreadTaskRunner> video_encode_task_runner_;
scoped_refptr<base::SingleThreadTaskRunner> network_task_runner_;
// Schedulers for audio and video capture.
Modified: trunk/src/remoting/host/plugin/host_script_object.cc
=========================================================================== ===
--- trunk/src/remoting/host/plugin/host_script_object.cc (original)
+++ trunk/src/remoting/host/plugin/host_script_object.cc Tue Nov 13 20:11:19 2012
@@ -369,8 +369,8 @@
CreateHostSessionManager(network_settings,
host_context_->url_request_context_getter()),
host_context_->audio_task_runner(),
- host_context_->capture_task_runner(),
- host_context_->encode_task_runner(),
+ host_context_->video_capture_task_runner(),
+ host_context_->video_encode_task_runner(),
host_context_->network_task_runner());
host_->AddStatusObserver(this);
log_to_server_.reset(
Modified: trunk/src/remoting/host/remoting_me2me_host.cc
=========================================================================== ===
--- trunk/src/remoting/host/remoting_me2me_host.cc (original)
+++ trunk/src/remoting/host/remoting_me2me_host.cc Tue Nov 13 20:11:19 2012
@@ -809,8 +809,8 @@
CreateHostSessionManager(network_settings,
context_->url_request_context_getter()),
context_->audio_task_runner(),
- context_->capture_task_runner(),
- context_->encode_task_runner(),
+ context_->video_capture_task_runner(),
+ context_->video_encode_task_runner(),
context_->network_task_runner());
// TODO(simonmorris): Get the maximum session duration from a policy.