| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/protocol/webrtc_transport.h" | 5 #include "remoting/protocol/webrtc_transport.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/base64.h" | 11 #include "base/base64.h" |
| 12 #include "base/callback_helpers.h" | 12 #include "base/callback_helpers.h" |
| 13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
| 14 #include "base/macros.h" | 14 #include "base/macros.h" |
| 15 #include "base/memory/ptr_util.h" | 15 #include "base/memory/ptr_util.h" |
| 16 #include "base/single_thread_task_runner.h" | 16 #include "base/single_thread_task_runner.h" |
| 17 #include "base/strings/string_number_conversions.h" | 17 #include "base/strings/string_number_conversions.h" |
| 18 #include "base/strings/string_split.h" | 18 #include "base/strings/string_split.h" |
| 19 #include "base/strings/string_util.h" | 19 #include "base/strings/string_util.h" |
| 20 #include "base/task_runner_util.h" | 20 #include "base/task_runner_util.h" |
| 21 #include "base/threading/thread_task_runner_handle.h" | 21 #include "base/threading/thread_task_runner_handle.h" |
| 22 #include "jingle/glue/thread_wrapper.h" | 22 #include "jingle/glue/thread_wrapper.h" |
| 23 #include "remoting/protocol/authenticator.h" | 23 #include "remoting/protocol/authenticator.h" |
| 24 #include "remoting/protocol/port_allocator_factory.h" | 24 #include "remoting/protocol/port_allocator_factory.h" |
| 25 #include "remoting/protocol/stream_message_pipe_adapter.h" | 25 #include "remoting/protocol/stream_message_pipe_adapter.h" |
| 26 #include "remoting/protocol/transport_context.h" | 26 #include "remoting/protocol/transport_context.h" |
| 27 #include "remoting/protocol/webrtc_video_encoder_factory.h" | 27 #include "remoting/protocol/webrtc_dummy_video_encoder.h" |
| 28 #include "third_party/webrtc/api/test/fakeconstraints.h" | 28 #include "third_party/webrtc/api/test/fakeconstraints.h" |
| 29 #include "third_party/webrtc/libjingle/xmllite/xmlelement.h" | 29 #include "third_party/webrtc/libjingle/xmllite/xmlelement.h" |
| 30 #include "third_party/webrtc/modules/audio_device/include/fake_audio_device.h" | 30 #include "third_party/webrtc/modules/audio_device/include/fake_audio_device.h" |
| 31 | 31 |
| 32 using buzz::QName; | 32 using buzz::QName; |
| 33 using buzz::XmlElement; | 33 using buzz::XmlElement; |
| 34 | 34 |
| 35 namespace remoting { | 35 namespace remoting { |
| 36 namespace protocol { | 36 namespace protocol { |
| 37 | 37 |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 | 264 |
| 265 // TODO(sergeyu): Investigate if it's possible to avoid Send(). | 265 // TODO(sergeyu): Investigate if it's possible to avoid Send(). |
| 266 jingle_glue::JingleThreadWrapper::current()->set_send_allowed(true); | 266 jingle_glue::JingleThreadWrapper::current()->set_send_allowed(true); |
| 267 | 267 |
| 268 send_transport_info_callback_ = std::move(send_transport_info_callback); | 268 send_transport_info_callback_ = std::move(send_transport_info_callback); |
| 269 | 269 |
| 270 if (!handshake_hmac_.Init(authenticator->GetAuthKey())) { | 270 if (!handshake_hmac_.Init(authenticator->GetAuthKey())) { |
| 271 LOG(FATAL) << "HMAC::Init() failed."; | 271 LOG(FATAL) << "HMAC::Init() failed."; |
| 272 } | 272 } |
| 273 | 273 |
| 274 video_encoder_factory_ = new remoting::WebrtcVideoEncoderFactory(); | 274 video_encoder_factory_ = new WebrtcDummyVideoEncoderFactory(); |
| 275 std::unique_ptr<cricket::PortAllocator> port_allocator = | 275 std::unique_ptr<cricket::PortAllocator> port_allocator = |
| 276 transport_context_->port_allocator_factory()->CreatePortAllocator( | 276 transport_context_->port_allocator_factory()->CreatePortAllocator( |
| 277 transport_context_); | 277 transport_context_); |
| 278 | 278 |
| 279 // Takes ownership of video_encoder_factory_. | 279 // Takes ownership of video_encoder_factory_. |
| 280 peer_connection_wrapper_.reset(new PeerConnectionWrapper( | 280 peer_connection_wrapper_.reset(new PeerConnectionWrapper( |
| 281 worker_thread_, base::WrapUnique(video_encoder_factory_), | 281 worker_thread_, base::WrapUnique(video_encoder_factory_), |
| 282 std::move(port_allocator), weak_factory_.GetWeakPtr())); | 282 std::move(port_allocator), weak_factory_.GetWeakPtr())); |
| 283 | 283 |
| 284 event_handler_->OnWebrtcTransportConnecting(); | 284 event_handler_->OnWebrtcTransportConnecting(); |
| (...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 660 // the stack and so it must be destroyed later. | 660 // the stack and so it must be destroyed later. |
| 661 base::ThreadTaskRunnerHandle::Get()->DeleteSoon( | 661 base::ThreadTaskRunnerHandle::Get()->DeleteSoon( |
| 662 FROM_HERE, peer_connection_wrapper_.release()); | 662 FROM_HERE, peer_connection_wrapper_.release()); |
| 663 | 663 |
| 664 if (error != OK) | 664 if (error != OK) |
| 665 event_handler_->OnWebrtcTransportError(error); | 665 event_handler_->OnWebrtcTransportError(error); |
| 666 } | 666 } |
| 667 | 667 |
| 668 } // namespace protocol | 668 } // namespace protocol |
| 669 } // namespace remoting | 669 } // namespace remoting |
| OLD | NEW |