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

Side by Side Diff: remoting/client/chromoting_client.cc

Issue 136763009: Add VideoProcessor interface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « remoting/client/chromoting_client.h ('k') | remoting/client/frame_consumer.h » ('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/client/chromoting_client.h" 5 #include "remoting/client/chromoting_client.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "remoting/base/capabilities.h" 8 #include "remoting/base/capabilities.h"
9 #include "remoting/client/audio_decode_scheduler.h" 9 #include "remoting/client/audio_decode_scheduler.h"
10 #include "remoting/client/audio_player.h" 10 #include "remoting/client/audio_player.h"
11 #include "remoting/client/client_context.h" 11 #include "remoting/client/client_context.h"
12 #include "remoting/client/client_user_interface.h" 12 #include "remoting/client/client_user_interface.h"
13 #include "remoting/client/rectangle_update_decoder.h" 13 #include "remoting/client/video_renderer.h"
14 #include "remoting/proto/audio.pb.h" 14 #include "remoting/proto/audio.pb.h"
15 #include "remoting/proto/video.pb.h" 15 #include "remoting/proto/video.pb.h"
16 #include "remoting/protocol/authentication_method.h" 16 #include "remoting/protocol/authentication_method.h"
17 #include "remoting/protocol/connection_to_host.h" 17 #include "remoting/protocol/connection_to_host.h"
18 #include "remoting/protocol/host_stub.h" 18 #include "remoting/protocol/host_stub.h"
19 #include "remoting/protocol/negotiating_client_authenticator.h" 19 #include "remoting/protocol/negotiating_client_authenticator.h"
20 #include "remoting/protocol/session_config.h" 20 #include "remoting/protocol/session_config.h"
21 #include "remoting/protocol/transport.h" 21 #include "remoting/protocol/transport.h"
22 22
23 namespace remoting { 23 namespace remoting {
24 24
25 using protocol::AuthenticationMethod; 25 using protocol::AuthenticationMethod;
26 26
27 ChromotingClient::ChromotingClient( 27 ChromotingClient::ChromotingClient(
28 const ClientConfig& config, 28 const ClientConfig& config,
29 ClientContext* client_context, 29 ClientContext* client_context,
30 protocol::ConnectionToHost* connection, 30 protocol::ConnectionToHost* connection,
31 ClientUserInterface* user_interface, 31 ClientUserInterface* user_interface,
32 scoped_refptr<FrameConsumerProxy> frame_consumer, 32 VideoRenderer* video_renderer,
33 scoped_ptr<AudioPlayer> audio_player) 33 scoped_ptr<AudioPlayer> audio_player)
34 : config_(config), 34 : config_(config),
35 task_runner_(client_context->main_task_runner()), 35 task_runner_(client_context->main_task_runner()),
36 connection_(connection), 36 connection_(connection),
37 user_interface_(user_interface), 37 user_interface_(user_interface),
38 video_renderer_(video_renderer),
38 host_capabilities_received_(false), 39 host_capabilities_received_(false),
39 weak_factory_(this) { 40 weak_factory_(this) {
40 rectangle_decoder_ =
41 new RectangleUpdateDecoder(client_context->main_task_runner(),
42 client_context->decode_task_runner(),
43 frame_consumer);
44 if (audio_player) { 41 if (audio_player) {
45 audio_decode_scheduler_.reset(new AudioDecodeScheduler( 42 audio_decode_scheduler_.reset(new AudioDecodeScheduler(
46 client_context->main_task_runner(), 43 client_context->main_task_runner(),
47 client_context->audio_decode_task_runner(), 44 client_context->audio_decode_task_runner(),
48 audio_player.Pass())); 45 audio_player.Pass()));
49 } 46 }
50 } 47 }
51 48
52 ChromotingClient::~ChromotingClient() { 49 ChromotingClient::~ChromotingClient() {
53 } 50 }
(...skipping 16 matching lines...) Expand all
70 weak_ptr_ = weak_factory_.GetWeakPtr(); 67 weak_ptr_ = weak_factory_.GetWeakPtr();
71 68
72 connection_->Connect(signal_strategy, 69 connection_->Connect(signal_strategy,
73 config_.host_jid, 70 config_.host_jid,
74 config_.host_public_key, 71 config_.host_public_key,
75 transport_factory.Pass(), 72 transport_factory.Pass(),
76 authenticator.Pass(), 73 authenticator.Pass(),
77 this, 74 this,
78 this, 75 this,
79 this, 76 this,
80 rectangle_decoder_.get(), 77 video_renderer_,
81 audio_decode_scheduler_.get()); 78 audio_decode_scheduler_.get());
82 } 79 }
83 80
84 FrameProducer* ChromotingClient::GetFrameProducer() {
85 return rectangle_decoder_.get();
86 }
87
88 ChromotingStats* ChromotingClient::GetStats() {
89 DCHECK(task_runner_->BelongsToCurrentThread());
90 return rectangle_decoder_->GetStats();
91 }
92
93 void ChromotingClient::SetCapabilities( 81 void ChromotingClient::SetCapabilities(
94 const protocol::Capabilities& capabilities) { 82 const protocol::Capabilities& capabilities) {
95 DCHECK(task_runner_->BelongsToCurrentThread()); 83 DCHECK(task_runner_->BelongsToCurrentThread());
96 84
97 // Only accept the first |protocol::Capabilities| message. 85 // Only accept the first |protocol::Capabilities| message.
98 if (host_capabilities_received_) { 86 if (host_capabilities_received_) {
99 LOG(WARNING) << "protocol::Capabilities has been received already."; 87 LOG(WARNING) << "protocol::Capabilities has been received already.";
100 return; 88 return;
101 } 89 }
102 90
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 const protocol::TransportRoute& route) { 151 const protocol::TransportRoute& route) {
164 VLOG(0) << "Using " << protocol::TransportRoute::GetTypeString(route.type) 152 VLOG(0) << "Using " << protocol::TransportRoute::GetTypeString(route.type)
165 << " connection for " << channel_name << " channel"; 153 << " connection for " << channel_name << " channel";
166 user_interface_->OnRouteChanged(channel_name, route); 154 user_interface_->OnRouteChanged(channel_name, route);
167 } 155 }
168 156
169 void ChromotingClient::OnAuthenticated() { 157 void ChromotingClient::OnAuthenticated() {
170 DCHECK(task_runner_->BelongsToCurrentThread()); 158 DCHECK(task_runner_->BelongsToCurrentThread());
171 159
172 // Initialize the decoder. 160 // Initialize the decoder.
173 rectangle_decoder_->Initialize(connection_->config()); 161 video_renderer_->Initialize(connection_->config());
174 if (connection_->config().is_audio_enabled()) 162 if (connection_->config().is_audio_enabled())
175 audio_decode_scheduler_->Initialize(connection_->config()); 163 audio_decode_scheduler_->Initialize(connection_->config());
176 164
177 // Do not negotiate capabilities with the host if the host does not support 165 // Do not negotiate capabilities with the host if the host does not support
178 // them. 166 // them.
179 if (!connection_->config().SupportsCapabilities()) { 167 if (!connection_->config().SupportsCapabilities()) {
180 VLOG(1) << "The host does not support any capabilities."; 168 VLOG(1) << "The host does not support any capabilities.";
181 169
182 host_capabilities_received_ = true; 170 host_capabilities_received_ = true;
183 user_interface_->SetCapabilities(host_capabilities_); 171 user_interface_->SetCapabilities(host_capabilities_);
184 } 172 }
185 } 173 }
186 174
187 void ChromotingClient::OnChannelsConnected() { 175 void ChromotingClient::OnChannelsConnected() {
188 DCHECK(task_runner_->BelongsToCurrentThread()); 176 DCHECK(task_runner_->BelongsToCurrentThread());
189 177
190 // Negotiate capabilities with the host. 178 // Negotiate capabilities with the host.
191 if (connection_->config().SupportsCapabilities()) { 179 if (connection_->config().SupportsCapabilities()) {
192 VLOG(1) << "Client capabilities: " << config_.capabilities; 180 VLOG(1) << "Client capabilities: " << config_.capabilities;
193 181
194 protocol::Capabilities capabilities; 182 protocol::Capabilities capabilities;
195 capabilities.set_capabilities(config_.capabilities); 183 capabilities.set_capabilities(config_.capabilities);
196 connection_->host_stub()->SetCapabilities(capabilities); 184 connection_->host_stub()->SetCapabilities(capabilities);
197 } 185 }
198 } 186 }
199 187
200 } // namespace remoting 188 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/client/chromoting_client.h ('k') | remoting/client/frame_consumer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698