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