Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(81)

Side by Side Diff: remoting/host/cast_extension_session.cc

Issue 1521883006: Add TransportContext class. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "remoting/host/cast_extension_session.h" 5 #include "remoting/host/cast_extension_session.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/json/json_reader.h" 8 #include "base/json/json_reader.h"
9 #include "base/json/json_writer.h" 9 #include "base/json/json_writer.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/synchronization/waitable_event.h" 11 #include "base/synchronization/waitable_event.h"
12 #include "net/url_request/url_request_context_getter.h" 12 #include "net/url_request/url_request_context_getter.h"
13 #include "remoting/host/client_session.h" 13 #include "remoting/host/client_session.h"
14 #include "remoting/proto/control.pb.h" 14 #include "remoting/proto/control.pb.h"
15 #include "remoting/protocol/chromium_port_allocator_factory.h" 15 #include "remoting/protocol/chromium_port_allocator.h"
16 #include "remoting/protocol/client_stub.h" 16 #include "remoting/protocol/client_stub.h"
17 #include "remoting/protocol/webrtc_video_capturer_adapter.h" 17 #include "remoting/protocol/webrtc_video_capturer_adapter.h"
18 #include "third_party/libjingle/source/talk/app/webrtc/mediastreaminterface.h" 18 #include "third_party/libjingle/source/talk/app/webrtc/mediastreaminterface.h"
19 #include "third_party/libjingle/source/talk/app/webrtc/test/fakeconstraints.h" 19 #include "third_party/libjingle/source/talk/app/webrtc/test/fakeconstraints.h"
20 #include "third_party/libjingle/source/talk/app/webrtc/videosourceinterface.h" 20 #include "third_party/libjingle/source/talk/app/webrtc/videosourceinterface.h"
21 21
22 namespace remoting { 22 namespace remoting {
23 23
24 // Used as the type attribute of all Cast protocol::ExtensionMessages. 24 // Used as the type attribute of all Cast protocol::ExtensionMessages.
25 const char kExtensionMessageType[] = "cast_message"; 25 const char kExtensionMessageType[] = "cast_message";
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after
490 490
491 // DTLS-SRTP is the preferred encryption method. If set to kValueFalse, the 491 // DTLS-SRTP is the preferred encryption method. If set to kValueFalse, the
492 // peer connection uses SDES. Disabling SDES as well will cause the peer 492 // peer connection uses SDES. Disabling SDES as well will cause the peer
493 // connection to fail to connect. 493 // connection to fail to connect.
494 // Note: For protection and unprotection of SRTP packets, the libjingle 494 // Note: For protection and unprotection of SRTP packets, the libjingle
495 // ENABLE_EXTERNAL_AUTH flag must not be set. 495 // ENABLE_EXTERNAL_AUTH flag must not be set.
496 webrtc::FakeConstraints constraints; 496 webrtc::FakeConstraints constraints;
497 constraints.AddMandatory(webrtc::MediaConstraintsInterface::kEnableDtlsSrtp, 497 constraints.AddMandatory(webrtc::MediaConstraintsInterface::kEnableDtlsSrtp,
498 webrtc::MediaConstraintsInterface::kValueTrue); 498 webrtc::MediaConstraintsInterface::kValueTrue);
499 499
500 rtc::scoped_refptr<webrtc::PortAllocatorFactoryInterface> 500 scoped_ptr<cricket::PortAllocator> port_allocator =
501 port_allocator_factory = protocol::ChromiumPortAllocatorFactory::Create( 501 protocol::ChromiumPortAllocator::Create(url_request_context_getter_);
502 network_settings_, url_request_context_getter_);
503 502
504 peer_connection_ = peer_conn_factory_->CreatePeerConnection( 503 peer_connection_ = peer_conn_factory_->CreatePeerConnection(
505 rtc_config, &constraints, port_allocator_factory, nullptr, this); 504 rtc_config, &constraints,
505 rtc::scoped_ptr<cricket::PortAllocator>(port_allocator.release()),
506 nullptr, this);
506 507
507 if (!peer_connection_.get()) { 508 if (!peer_connection_.get()) {
508 CleanupPeerConnection(); 509 CleanupPeerConnection();
509 return false; 510 return false;
510 } 511 }
511 512
512 VLOG(1) << "Created PeerConnection successfully."; 513 VLOG(1) << "Created PeerConnection successfully.";
513 514
514 create_session_desc_observer_ = 515 create_session_desc_observer_ =
515 CastCreateSessionDescriptionObserver::Create(this); 516 CastCreateSessionDescriptionObserver::Create(this);
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
653 json.SetString(kWebRtcCandidate, candidate_str); 654 json.SetString(kWebRtcCandidate, candidate_str);
654 std::string json_str; 655 std::string json_str;
655 if (!base::JSONWriter::Write(json, &json_str)) { 656 if (!base::JSONWriter::Write(json, &json_str)) {
656 LOG(ERROR) << "Failed to serialize candidate message."; 657 LOG(ERROR) << "Failed to serialize candidate message.";
657 return; 658 return;
658 } 659 }
659 SendMessageToClient(kSubjectNewCandidate, json_str); 660 SendMessageToClient(kSubjectNewCandidate, json_str);
660 } 661 }
661 662
662 } // namespace remoting 663 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698