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 "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 #include "remoting/client/jni/jni_pairing_secret_fetcher.h" | 24 #include "remoting/client/jni/jni_pairing_secret_fetcher.h" |
25 #include "remoting/client/jni/jni_video_renderer.h" | 25 #include "remoting/client/jni/jni_video_renderer.h" |
26 #include "remoting/protocol/chromium_port_allocator_factory.h" | 26 #include "remoting/protocol/chromium_port_allocator_factory.h" |
27 #include "remoting/protocol/chromium_socket_factory.h" | 27 #include "remoting/protocol/chromium_socket_factory.h" |
28 #include "remoting/protocol/client_authentication_config.h" | 28 #include "remoting/protocol/client_authentication_config.h" |
29 #include "remoting/protocol/frame_consumer.h" | 29 #include "remoting/protocol/frame_consumer.h" |
30 #include "remoting/protocol/host_stub.h" | 30 #include "remoting/protocol/host_stub.h" |
31 #include "remoting/protocol/network_settings.h" | 31 #include "remoting/protocol/network_settings.h" |
32 #include "remoting/protocol/performance_tracker.h" | 32 #include "remoting/protocol/performance_tracker.h" |
33 #include "remoting/protocol/transport_context.h" | 33 #include "remoting/protocol/transport_context.h" |
| 34 #include "remoting/protocol/video_renderer.h" |
34 #include "remoting/signaling/server_log_entry.h" | 35 #include "remoting/signaling/server_log_entry.h" |
35 #include "ui/events/keycodes/dom/keycode_converter.h" | 36 #include "ui/events/keycodes/dom/keycode_converter.h" |
36 | 37 |
37 namespace remoting { | 38 namespace remoting { |
38 | 39 |
39 namespace { | 40 namespace { |
40 | 41 |
41 // TODO(solb) Move into location shared with client plugin. | 42 // TODO(solb) Move into location shared with client plugin. |
42 const char* const kXmppServer = "talk.google.com"; | 43 const char* const kXmppServer = "talk.google.com"; |
43 const int kXmppPort = 5222; | 44 const int kXmppPort = 5222; |
44 const bool kXmppUseTls = true; | 45 const bool kXmppUseTls = true; |
45 | 46 |
46 // Interval at which to log performance statistics, if enabled. | 47 // Interval at which to log performance statistics, if enabled. |
47 const int kPerfStatsIntervalMs = 60000; | 48 const int kPerfStatsIntervalMs = 60000; |
48 | 49 |
49 } // namespace | 50 } // namespace |
50 | 51 |
51 ChromotingJniInstance::ChromotingJniInstance( | 52 ChromotingJniInstance::ChromotingJniInstance( |
52 ChromotingJniRuntime* jni_runtime, | 53 ChromotingJniRuntime* jni_runtime, |
53 base::WeakPtr<JniClient> jni_client, | 54 base::WeakPtr<JniClient> jni_client, |
54 base::WeakPtr<JniPairingSecretFetcher> secret_fetcher, | 55 base::WeakPtr<JniPairingSecretFetcher> secret_fetcher, |
55 std::unique_ptr<protocol::CursorShapeStub> cursor_shape_stub, | 56 std::unique_ptr<protocol::CursorShapeStub> cursor_shape_stub, |
56 std::unique_ptr<JniVideoRenderer> video_renderer, | 57 std::unique_ptr<protocol::VideoRenderer> video_renderer, |
57 const std::string& username, | 58 const std::string& username, |
58 const std::string& auth_token, | 59 const std::string& auth_token, |
59 const std::string& host_jid, | 60 const std::string& host_jid, |
60 const std::string& host_id, | 61 const std::string& host_id, |
61 const std::string& host_pubkey, | 62 const std::string& host_pubkey, |
62 const std::string& pairing_id, | 63 const std::string& pairing_id, |
63 const std::string& pairing_secret, | 64 const std::string& pairing_secret, |
64 const std::string& capabilities, | 65 const std::string& capabilities, |
65 const std::string& flags) | 66 const std::string& flags) |
66 : jni_runtime_(jni_runtime), | 67 : jni_runtime_(jni_runtime), |
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
374 void ChromotingJniInstance::ConnectToHostOnNetworkThread() { | 375 void ChromotingJniInstance::ConnectToHostOnNetworkThread() { |
375 DCHECK(jni_runtime_->network_task_runner()->BelongsToCurrentThread()); | 376 DCHECK(jni_runtime_->network_task_runner()->BelongsToCurrentThread()); |
376 | 377 |
377 jingle_glue::JingleThreadWrapper::EnsureForCurrentMessageLoop(); | 378 jingle_glue::JingleThreadWrapper::EnsureForCurrentMessageLoop(); |
378 | 379 |
379 client_context_.reset(new ClientContext(jni_runtime_->network_task_runner())); | 380 client_context_.reset(new ClientContext(jni_runtime_->network_task_runner())); |
380 client_context_->Start(); | 381 client_context_->Start(); |
381 | 382 |
382 perf_tracker_.reset(new protocol::PerformanceTracker()); | 383 perf_tracker_.reset(new protocol::PerformanceTracker()); |
383 | 384 |
384 video_renderer_->Initialize(client_context_->decode_task_runner(), | 385 video_renderer_->Initialize(*client_context_, |
385 perf_tracker_.get()); | 386 perf_tracker_.get()); |
386 | 387 |
387 if (!audio_player_) { | 388 if (!audio_player_) { |
388 audio_player_.reset(new AudioPlayerAndroid()); | 389 audio_player_.reset(new AudioPlayerAndroid()); |
389 } | 390 } |
390 | 391 |
391 client_.reset(new ChromotingClient(client_context_.get(), this, | 392 client_.reset(new ChromotingClient(client_context_.get(), this, |
392 video_renderer_.get(), | 393 video_renderer_.get(), |
393 audio_player_->GetWeakPtr())); | 394 audio_player_->GetWeakPtr())); |
394 | 395 |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
495 video_renderer_.reset(); | 496 video_renderer_.reset(); |
496 signaling_.reset(); | 497 signaling_.reset(); |
497 perf_tracker_.reset(); | 498 perf_tracker_.reset(); |
498 client_context_.reset(); | 499 client_context_.reset(); |
499 cursor_shape_stub_.reset(); | 500 cursor_shape_stub_.reset(); |
500 | 501 |
501 weak_factory_.InvalidateWeakPtrs(); | 502 weak_factory_.InvalidateWeakPtrs(); |
502 } | 503 } |
503 | 504 |
504 } // namespace remoting | 505 } // namespace remoting |
OLD | NEW |