OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/jni/chromoting_jni_instance.h" | 5 #include "remoting/client/jni/chromoting_jni_instance.h" |
6 | 6 |
7 #include <android/log.h> | 7 #include <android/log.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <utility> | 10 #include <utility> |
11 | 11 |
12 #include "base/bind.h" | 12 #include "base/bind.h" |
13 #include "base/callback_helpers.h" | 13 #include "base/callback_helpers.h" |
14 #include "base/format_macros.h" | 14 #include "base/format_macros.h" |
15 #include "base/logging.h" | 15 #include "base/logging.h" |
| 16 #include "base/memory/ptr_util.h" |
16 #include "jingle/glue/thread_wrapper.h" | 17 #include "jingle/glue/thread_wrapper.h" |
17 #include "net/socket/client_socket_factory.h" | 18 #include "net/socket/client_socket_factory.h" |
18 #include "remoting/base/chromium_url_request.h" | 19 #include "remoting/base/chromium_url_request.h" |
19 #include "remoting/client/audio_player.h" | 20 #include "remoting/client/audio_player.h" |
20 #include "remoting/client/client_status_logger.h" | 21 #include "remoting/client/client_status_logger.h" |
21 #include "remoting/client/jni/android_keymap.h" | 22 #include "remoting/client/jni/android_keymap.h" |
22 #include "remoting/client/jni/chromoting_jni_runtime.h" | 23 #include "remoting/client/jni/chromoting_jni_runtime.h" |
23 #include "remoting/client/jni/jni_frame_consumer.h" | 24 #include "remoting/client/jni/jni_frame_consumer.h" |
24 #include "remoting/client/software_video_renderer.h" | 25 #include "remoting/client/software_video_renderer.h" |
25 #include "remoting/protocol/chromium_port_allocator_factory.h" | 26 #include "remoting/protocol/chromium_port_allocator_factory.h" |
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 signaling_.reset( | 402 signaling_.reset( |
402 new XmppSignalStrategy(net::ClientSocketFactory::GetDefaultFactory(), | 403 new XmppSignalStrategy(net::ClientSocketFactory::GetDefaultFactory(), |
403 jni_runtime_->url_requester(), xmpp_config_)); | 404 jni_runtime_->url_requester(), xmpp_config_)); |
404 | 405 |
405 client_status_logger_.reset(new ClientStatusLogger( | 406 client_status_logger_.reset(new ClientStatusLogger( |
406 ServerLogEntry::ME2ME, signaling_.get(), kDirectoryBotJid)); | 407 ServerLogEntry::ME2ME, signaling_.get(), kDirectoryBotJid)); |
407 | 408 |
408 scoped_refptr<protocol::TransportContext> transport_context = | 409 scoped_refptr<protocol::TransportContext> transport_context = |
409 new protocol::TransportContext( | 410 new protocol::TransportContext( |
410 signaling_.get(), | 411 signaling_.get(), |
411 make_scoped_ptr(new protocol::ChromiumPortAllocatorFactory()), | 412 base::WrapUnique(new protocol::ChromiumPortAllocatorFactory()), |
412 make_scoped_ptr( | 413 base::WrapUnique( |
413 new ChromiumUrlRequestFactory(jni_runtime_->url_requester())), | 414 new ChromiumUrlRequestFactory(jni_runtime_->url_requester())), |
414 protocol::NetworkSettings( | 415 protocol::NetworkSettings( |
415 protocol::NetworkSettings::NAT_TRAVERSAL_FULL), | 416 protocol::NetworkSettings::NAT_TRAVERSAL_FULL), |
416 protocol::TransportRole::CLIENT); | 417 protocol::TransportRole::CLIENT); |
417 | 418 |
418 #if defined(ENABLE_WEBRTC_REMOTING_CLIENT) | 419 #if defined(ENABLE_WEBRTC_REMOTING_CLIENT) |
419 if (flags_.find("useWebrtc") != std::string::npos) { | 420 if (flags_.find("useWebrtc") != std::string::npos) { |
420 VLOG(0) << "Attempting to connect using WebRTC."; | 421 VLOG(0) << "Attempting to connect using WebRTC."; |
421 scoped_ptr<protocol::CandidateSessionConfig> protocol_config = | 422 std::unique_ptr<protocol::CandidateSessionConfig> protocol_config = |
422 protocol::CandidateSessionConfig::CreateEmpty(); | 423 protocol::CandidateSessionConfig::CreateEmpty(); |
423 protocol_config->set_webrtc_supported(true); | 424 protocol_config->set_webrtc_supported(true); |
424 protocol_config->set_ice_supported(false); | 425 protocol_config->set_ice_supported(false); |
425 client_->set_protocol_config(std::move(protocol_config)); | 426 client_->set_protocol_config(std::move(protocol_config)); |
426 } | 427 } |
427 #endif // defined(ENABLE_WEBRTC_REMOTING_CLIENT) | 428 #endif // defined(ENABLE_WEBRTC_REMOTING_CLIENT) |
428 client_->Start(signaling_.get(), client_auth_config_, transport_context, | 429 client_->Start(signaling_.get(), client_auth_config_, transport_context, |
429 host_jid_, capabilities_); | 430 host_jid_, capabilities_); |
430 } | 431 } |
431 | 432 |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
507 perf_tracker_->round_trip_ms().Max()); | 508 perf_tracker_->round_trip_ms().Max()); |
508 | 509 |
509 client_status_logger_->LogStatistics(perf_tracker_.get()); | 510 client_status_logger_->LogStatistics(perf_tracker_.get()); |
510 | 511 |
511 jni_runtime_->network_task_runner()->PostDelayedTask( | 512 jni_runtime_->network_task_runner()->PostDelayedTask( |
512 FROM_HERE, base::Bind(&ChromotingJniInstance::LogPerfStats, this), | 513 FROM_HERE, base::Bind(&ChromotingJniInstance::LogPerfStats, this), |
513 base::TimeDelta::FromMilliseconds(kPerfStatsIntervalMs)); | 514 base::TimeDelta::FromMilliseconds(kPerfStatsIntervalMs)); |
514 } | 515 } |
515 | 516 |
516 } // namespace remoting | 517 } // namespace remoting |
OLD | NEW |