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

Side by Side Diff: remoting/host/client_session.cc

Issue 11260053: Use correct thread for audio capturing and encoding. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « remoting/host/client_session.h ('k') | remoting/host/client_session_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "remoting/host/client_session.h" 5 #include "remoting/host/client_session.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/message_loop_proxy.h" 9 #include "base/message_loop_proxy.h"
10 #include "remoting/codec/audio_encoder.h" 10 #include "remoting/codec/audio_encoder.h"
(...skipping 11 matching lines...) Expand all
22 #include "remoting/host/video_scheduler.h" 22 #include "remoting/host/video_scheduler.h"
23 #include "remoting/proto/control.pb.h" 23 #include "remoting/proto/control.pb.h"
24 #include "remoting/proto/event.pb.h" 24 #include "remoting/proto/event.pb.h"
25 #include "remoting/protocol/client_stub.h" 25 #include "remoting/protocol/client_stub.h"
26 #include "remoting/protocol/clipboard_thread_proxy.h" 26 #include "remoting/protocol/clipboard_thread_proxy.h"
27 27
28 namespace remoting { 28 namespace remoting {
29 29
30 ClientSession::ClientSession( 30 ClientSession::ClientSession(
31 EventHandler* event_handler, 31 EventHandler* event_handler,
32 scoped_refptr<base::SingleThreadTaskRunner> audio_task_runner,
32 scoped_refptr<base::SingleThreadTaskRunner> capture_task_runner, 33 scoped_refptr<base::SingleThreadTaskRunner> capture_task_runner,
33 scoped_refptr<base::SingleThreadTaskRunner> encode_task_runner, 34 scoped_refptr<base::SingleThreadTaskRunner> encode_task_runner,
34 scoped_refptr<base::SingleThreadTaskRunner> network_task_runner, 35 scoped_refptr<base::SingleThreadTaskRunner> network_task_runner,
35 scoped_ptr<protocol::ConnectionToClient> connection, 36 scoped_ptr<protocol::ConnectionToClient> connection,
36 DesktopEnvironmentFactory* desktop_environment_factory, 37 DesktopEnvironmentFactory* desktop_environment_factory,
37 const base::TimeDelta& max_duration) 38 const base::TimeDelta& max_duration)
38 : event_handler_(event_handler), 39 : event_handler_(event_handler),
39 connection_(connection.Pass()), 40 connection_(connection.Pass()),
40 desktop_environment_(desktop_environment_factory->Create( 41 desktop_environment_(desktop_environment_factory->Create(
41 ALLOW_THIS_IN_INITIALIZER_LIST(this))), 42 ALLOW_THIS_IN_INITIALIZER_LIST(this))),
42 client_jid_(connection_->session()->jid()), 43 client_jid_(connection_->session()->jid()),
43 host_clipboard_stub_(desktop_environment_->event_executor()), 44 host_clipboard_stub_(desktop_environment_->event_executor()),
44 host_input_stub_(desktop_environment_->event_executor()), 45 host_input_stub_(desktop_environment_->event_executor()),
45 input_tracker_(host_input_stub_), 46 input_tracker_(host_input_stub_),
46 remote_input_filter_(&input_tracker_), 47 remote_input_filter_(&input_tracker_),
47 mouse_clamping_filter_(desktop_environment_->video_capturer(), 48 mouse_clamping_filter_(desktop_environment_->video_capturer(),
48 &remote_input_filter_), 49 &remote_input_filter_),
49 disable_input_filter_(&mouse_clamping_filter_), 50 disable_input_filter_(&mouse_clamping_filter_),
50 disable_clipboard_filter_(clipboard_echo_filter_.host_filter()), 51 disable_clipboard_filter_(clipboard_echo_filter_.host_filter()),
51 auth_input_filter_(&disable_input_filter_), 52 auth_input_filter_(&disable_input_filter_),
52 auth_clipboard_filter_(&disable_clipboard_filter_), 53 auth_clipboard_filter_(&disable_clipboard_filter_),
53 client_clipboard_factory_(clipboard_echo_filter_.client_filter()), 54 client_clipboard_factory_(clipboard_echo_filter_.client_filter()),
54 max_duration_(max_duration), 55 max_duration_(max_duration),
56 audio_task_runner_(audio_task_runner),
55 capture_task_runner_(capture_task_runner), 57 capture_task_runner_(capture_task_runner),
56 encode_task_runner_(encode_task_runner), 58 encode_task_runner_(encode_task_runner),
57 network_task_runner_(network_task_runner), 59 network_task_runner_(network_task_runner),
58 active_recorders_(0) { 60 active_recorders_(0) {
59 connection_->SetEventHandler(this); 61 connection_->SetEventHandler(this);
60 62
61 // TODO(sergeyu): Currently ConnectionToClient expects stubs to be 63 // TODO(sergeyu): Currently ConnectionToClient expects stubs to be
62 // set before channels are connected. Make it possible to set stubs 64 // set before channels are connected. Make it possible to set stubs
63 // later and set them only when connection is authenticated. 65 // later and set them only when connection is authenticated.
64 connection_->set_clipboard_stub(&auth_clipboard_filter_); 66 connection_->set_clipboard_stub(&auth_clipboard_filter_);
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 video_encoder.Pass(), 141 video_encoder.Pass(),
140 connection_->client_stub(), 142 connection_->client_stub(),
141 connection_->video_stub()); 143 connection_->video_stub());
142 ++active_recorders_; 144 ++active_recorders_;
143 145
144 // Create an AudioScheduler if audio is enabled, to pump audio samples. 146 // Create an AudioScheduler if audio is enabled, to pump audio samples.
145 if (connection_->session()->config().is_audio_enabled()) { 147 if (connection_->session()->config().is_audio_enabled()) {
146 scoped_ptr<AudioEncoder> audio_encoder = 148 scoped_ptr<AudioEncoder> audio_encoder =
147 CreateAudioEncoder(connection_->session()->config()); 149 CreateAudioEncoder(connection_->session()->config());
148 audio_scheduler_ = new AudioScheduler( 150 audio_scheduler_ = new AudioScheduler(
149 capture_task_runner_, 151 audio_task_runner_,
150 network_task_runner_, 152 network_task_runner_,
151 desktop_environment_->audio_capturer(), 153 desktop_environment_->audio_capturer(),
152 audio_encoder.Pass(), 154 audio_encoder.Pass(),
153 connection_->audio_stub()); 155 connection_->audio_stub());
154 ++active_recorders_; 156 ++active_recorders_;
155 } 157 }
156 158
157 // Let the desktop environment notify us of local clipboard changes. 159 // Let the desktop environment notify us of local clipboard changes.
158 desktop_environment_->Start(CreateClipboardProxy()); 160 desktop_environment_->Start(CreateClipboardProxy());
159 161
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 NOTIMPLEMENTED(); 316 NOTIMPLEMENTED();
315 return scoped_ptr<AudioEncoder>(NULL); 317 return scoped_ptr<AudioEncoder>(NULL);
316 } 318 }
317 319
318 // static 320 // static
319 void ClientSessionTraits::Destruct(const ClientSession* client) { 321 void ClientSessionTraits::Destruct(const ClientSession* client) {
320 client->network_task_runner_->DeleteSoon(FROM_HERE, client); 322 client->network_task_runner_->DeleteSoon(FROM_HERE, client);
321 } 323 }
322 324
323 } // namespace remoting 325 } // namespace remoting
OLDNEW
« 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