OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2012 The WebRTC Project Authors. All rights reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 peer_connection_->AddStream(streams->at(i)); | 106 peer_connection_->AddStream(streams->at(i)); |
107 peer_connection_->CreateOffer(this, NULL); | 107 peer_connection_->CreateOffer(this, NULL); |
108 } | 108 } |
109 return peer_connection_.get() != NULL; | 109 return peer_connection_.get() != NULL; |
110 } | 110 } |
111 | 111 |
112 bool Conductor::CreatePeerConnection(bool dtls) { | 112 bool Conductor::CreatePeerConnection(bool dtls) { |
113 ASSERT(peer_connection_factory_.get() != NULL); | 113 ASSERT(peer_connection_factory_.get() != NULL); |
114 ASSERT(peer_connection_.get() == NULL); | 114 ASSERT(peer_connection_.get() == NULL); |
115 | 115 |
116 webrtc::PeerConnectionInterface::IceServers servers; | 116 webrtc::PeerConnectionInterface::RTCConfiguration config; |
117 webrtc::PeerConnectionInterface::IceServer server; | 117 webrtc::PeerConnectionInterface::IceServer server; |
118 server.uri = GetPeerConnectionString(); | 118 server.uri = GetPeerConnectionString(); |
119 servers.push_back(server); | 119 config.servers.push_back(server); |
120 | 120 |
121 webrtc::FakeConstraints constraints; | 121 webrtc::FakeConstraints constraints; |
122 if (dtls) { | 122 if (dtls) { |
123 constraints.AddOptional(webrtc::MediaConstraintsInterface::kEnableDtlsSrtp, | 123 constraints.AddOptional(webrtc::MediaConstraintsInterface::kEnableDtlsSrtp, |
124 "true"); | 124 "true"); |
125 } else { | 125 } else { |
126 constraints.AddOptional(webrtc::MediaConstraintsInterface::kEnableDtlsSrtp, | 126 constraints.AddOptional(webrtc::MediaConstraintsInterface::kEnableDtlsSrtp, |
127 "false"); | 127 "false"); |
128 } | 128 } |
129 | 129 |
130 peer_connection_ = | 130 peer_connection_ = peer_connection_factory_->CreatePeerConnection( |
131 peer_connection_factory_->CreatePeerConnection(servers, | 131 config, &constraints, NULL, NULL, this); |
132 &constraints, | |
133 NULL, | |
134 NULL, | |
135 this); | |
136 return peer_connection_.get() != NULL; | 132 return peer_connection_.get() != NULL; |
137 } | 133 } |
138 | 134 |
139 void Conductor::DeletePeerConnection() { | 135 void Conductor::DeletePeerConnection() { |
140 peer_connection_ = NULL; | 136 peer_connection_ = NULL; |
141 active_streams_.clear(); | 137 active_streams_.clear(); |
142 main_wnd_->StopLocalRenderer(); | 138 main_wnd_->StopLocalRenderer(); |
143 main_wnd_->StopRemoteRenderer(); | 139 main_wnd_->StopRemoteRenderer(); |
144 peer_connection_factory_ = NULL; | 140 peer_connection_factory_ = NULL; |
145 peer_id_ = -1; | 141 peer_id_ = -1; |
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
535 } | 531 } |
536 | 532 |
537 void Conductor::OnFailure(const std::string& error) { | 533 void Conductor::OnFailure(const std::string& error) { |
538 LOG(LERROR) << error; | 534 LOG(LERROR) << error; |
539 } | 535 } |
540 | 536 |
541 void Conductor::SendMessage(const std::string& json_object) { | 537 void Conductor::SendMessage(const std::string& json_object) { |
542 std::string* msg = new std::string(json_object); | 538 std::string* msg = new std::string(json_object); |
543 main_wnd_->QueueUIThreadCallback(SEND_MESSAGE_TO_PEER, msg); | 539 main_wnd_->QueueUIThreadCallback(SEND_MESSAGE_TO_PEER, msg); |
544 } | 540 } |
OLD | NEW |