OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "base/base64.h" | 5 #include "base/base64.h" |
6 #include "base/files/file_util.h" | 6 #include "base/files/file_util.h" |
7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
8 #include "base/rand_util.h" | 8 #include "base/rand_util.h" |
9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
11 #include "base/synchronization/waitable_event.h" | 11 #include "base/synchronization/waitable_event.h" |
12 #include "base/thread_task_runner_handle.h" | 12 #include "base/thread_task_runner_handle.h" |
13 #include "jingle/glue/thread_wrapper.h" | 13 #include "jingle/glue/thread_wrapper.h" |
14 #include "net/base/test_data_directory.h" | 14 #include "net/base/test_data_directory.h" |
15 #include "net/url_request/url_request_context_getter.h" | 15 #include "net/url_request/url_request_context_getter.h" |
16 #include "remoting/base/rsa_key_pair.h" | 16 #include "remoting/base/rsa_key_pair.h" |
17 #include "remoting/client/audio_player.h" | 17 #include "remoting/client/audio_player.h" |
18 #include "remoting/client/chromoting_client.h" | 18 #include "remoting/client/chromoting_client.h" |
19 #include "remoting/client/client_context.h" | 19 #include "remoting/client/client_context.h" |
20 #include "remoting/client/client_user_interface.h" | 20 #include "remoting/client/client_user_interface.h" |
21 #include "remoting/client/video_renderer.h" | 21 #include "remoting/client/video_renderer.h" |
22 #include "remoting/host/chromoting_host.h" | 22 #include "remoting/host/chromoting_host.h" |
23 #include "remoting/host/chromoting_host_context.h" | 23 #include "remoting/host/chromoting_host_context.h" |
24 #include "remoting/host/fake_desktop_environment.h" | 24 #include "remoting/host/fake_desktop_environment.h" |
25 #include "remoting/protocol/ice_transport.h" | |
26 #include "remoting/protocol/jingle_session_manager.h" | 25 #include "remoting/protocol/jingle_session_manager.h" |
27 #include "remoting/protocol/me2me_host_authenticator_factory.h" | 26 #include "remoting/protocol/me2me_host_authenticator_factory.h" |
28 #include "remoting/protocol/negotiating_client_authenticator.h" | 27 #include "remoting/protocol/negotiating_client_authenticator.h" |
29 #include "remoting/protocol/session_config.h" | 28 #include "remoting/protocol/session_config.h" |
30 #include "remoting/protocol/transport_context.h" | 29 #include "remoting/protocol/transport_context.h" |
31 #include "remoting/protocol/video_frame_pump.h" | 30 #include "remoting/protocol/video_frame_pump.h" |
32 #include "remoting/signaling/fake_signal_strategy.h" | 31 #include "remoting/signaling/fake_signal_strategy.h" |
33 #include "remoting/test/fake_network_dispatcher.h" | 32 #include "remoting/test/fake_network_dispatcher.h" |
34 #include "remoting/test/fake_port_allocator.h" | 33 #include "remoting/test/fake_port_allocator.h" |
35 #include "remoting/test/fake_socket_factory.h" | 34 #include "remoting/test/fake_socket_factory.h" |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 port_allocator_factory->socket_factory()->SetBandwidth( | 229 port_allocator_factory->socket_factory()->SetBandwidth( |
231 GetParam().bandwidth, GetParam().max_buffers); | 230 GetParam().bandwidth, GetParam().max_buffers); |
232 port_allocator_factory->socket_factory()->SetLatency( | 231 port_allocator_factory->socket_factory()->SetLatency( |
233 GetParam().latency_average, GetParam().latency_stddev); | 232 GetParam().latency_average, GetParam().latency_stddev); |
234 port_allocator_factory->socket_factory()->set_out_of_order_rate( | 233 port_allocator_factory->socket_factory()->set_out_of_order_rate( |
235 GetParam().out_of_order_rate); | 234 GetParam().out_of_order_rate); |
236 scoped_refptr<protocol::TransportContext> transport_context( | 235 scoped_refptr<protocol::TransportContext> transport_context( |
237 new protocol::TransportContext( | 236 new protocol::TransportContext( |
238 host_signaling_.get(), std::move(port_allocator_factory), | 237 host_signaling_.get(), std::move(port_allocator_factory), |
239 network_settings, protocol::TransportRole::SERVER)); | 238 network_settings, protocol::TransportRole::SERVER)); |
240 | |
241 scoped_ptr<protocol::SessionManager> session_manager( | 239 scoped_ptr<protocol::SessionManager> session_manager( |
242 new protocol::JingleSessionManager( | 240 new protocol::JingleSessionManager(host_signaling_.get())); |
243 make_scoped_ptr( | |
244 new protocol::IceTransportFactory(transport_context)), | |
245 host_signaling_.get())); | |
246 session_manager->set_protocol_config(protocol_config_->Clone()); | 241 session_manager->set_protocol_config(protocol_config_->Clone()); |
247 | 242 |
248 // Encoder runs on a separate thread, main thread is used for everything | 243 // Encoder runs on a separate thread, main thread is used for everything |
249 // else. | 244 // else. |
250 host_.reset(new ChromotingHost( | 245 host_.reset(new ChromotingHost( |
251 &desktop_environment_factory_, std::move(session_manager), | 246 &desktop_environment_factory_, std::move(session_manager), |
252 host_thread_.task_runner(), host_thread_.task_runner(), | 247 transport_context, host_thread_.task_runner(), |
253 capture_thread_.task_runner(), encode_thread_.task_runner(), | 248 host_thread_.task_runner(), capture_thread_.task_runner(), |
254 host_thread_.task_runner(), host_thread_.task_runner())); | 249 encode_thread_.task_runner(), host_thread_.task_runner(), |
| 250 host_thread_.task_runner())); |
255 | 251 |
256 base::FilePath certs_dir(net::GetTestCertsDirectory()); | 252 base::FilePath certs_dir(net::GetTestCertsDirectory()); |
257 | 253 |
258 std::string host_cert; | 254 std::string host_cert; |
259 ASSERT_TRUE(base::ReadFileToString( | 255 ASSERT_TRUE(base::ReadFileToString( |
260 certs_dir.AppendASCII("unittest.selfsigned.der"), &host_cert)); | 256 certs_dir.AppendASCII("unittest.selfsigned.der"), &host_cert)); |
261 | 257 |
262 base::FilePath key_path = certs_dir.AppendASCII("unittest.key.bin"); | 258 base::FilePath key_path = certs_dir.AppendASCII("unittest.key.bin"); |
263 std::string key_string; | 259 std::string key_string; |
264 ASSERT_TRUE(base::ReadFileToString(key_path, &key_string)); | 260 ASSERT_TRUE(base::ReadFileToString(key_path, &key_string)); |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
483 << "ms Encode: " << last_video_packet_->encode_time_ms() | 479 << "ms Encode: " << last_video_packet_->encode_time_ms() |
484 << "ms Capture: " << last_video_packet_->capture_time_ms() | 480 << "ms Capture: " << last_video_packet_->capture_time_ms() |
485 << "ms"; | 481 << "ms"; |
486 sum += latency; | 482 sum += latency; |
487 } | 483 } |
488 | 484 |
489 LOG(INFO) << "Average: " << (sum / kFrames).InMillisecondsF(); | 485 LOG(INFO) << "Average: " << (sum / kFrames).InMillisecondsF(); |
490 } | 486 } |
491 | 487 |
492 } // namespace remoting | 488 } // namespace remoting |
OLD | NEW |