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 |
11 #include "webrtc/examples/peerconnection/client/conductor.h" | 11 #include "webrtc/examples/peerconnection/client/conductor.h" |
12 | 12 |
| 13 #include <memory> |
13 #include <utility> | 14 #include <utility> |
14 #include <vector> | 15 #include <vector> |
15 | 16 |
16 #include "webrtc/api/test/fakeconstraints.h" | 17 #include "webrtc/api/test/fakeconstraints.h" |
17 #include "webrtc/base/common.h" | 18 #include "webrtc/base/common.h" |
18 #include "webrtc/base/json.h" | 19 #include "webrtc/base/json.h" |
19 #include "webrtc/base/logging.h" | 20 #include "webrtc/base/logging.h" |
20 #include "webrtc/examples/peerconnection/client/defaults.h" | 21 #include "webrtc/examples/peerconnection/client/defaults.h" |
21 #include "webrtc/media/engine/webrtcvideocapturerfactory.h" | 22 #include "webrtc/media/engine/webrtcvideocapturerfactory.h" |
22 #include "webrtc/modules/video_capture/video_capture_factory.h" | 23 #include "webrtc/modules/video_capture/video_capture_factory.h" |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 std::string sdp; | 302 std::string sdp; |
302 if (!rtc::GetStringFromJsonObject(jmessage, kCandidateSdpMidName, | 303 if (!rtc::GetStringFromJsonObject(jmessage, kCandidateSdpMidName, |
303 &sdp_mid) || | 304 &sdp_mid) || |
304 !rtc::GetIntFromJsonObject(jmessage, kCandidateSdpMlineIndexName, | 305 !rtc::GetIntFromJsonObject(jmessage, kCandidateSdpMlineIndexName, |
305 &sdp_mlineindex) || | 306 &sdp_mlineindex) || |
306 !rtc::GetStringFromJsonObject(jmessage, kCandidateSdpName, &sdp)) { | 307 !rtc::GetStringFromJsonObject(jmessage, kCandidateSdpName, &sdp)) { |
307 LOG(WARNING) << "Can't parse received message."; | 308 LOG(WARNING) << "Can't parse received message."; |
308 return; | 309 return; |
309 } | 310 } |
310 webrtc::SdpParseError error; | 311 webrtc::SdpParseError error; |
311 rtc::scoped_ptr<webrtc::IceCandidateInterface> candidate( | 312 std::unique_ptr<webrtc::IceCandidateInterface> candidate( |
312 webrtc::CreateIceCandidate(sdp_mid, sdp_mlineindex, sdp, &error)); | 313 webrtc::CreateIceCandidate(sdp_mid, sdp_mlineindex, sdp, &error)); |
313 if (!candidate.get()) { | 314 if (!candidate.get()) { |
314 LOG(WARNING) << "Can't parse received candidate message. " | 315 LOG(WARNING) << "Can't parse received candidate message. " |
315 << "SdpParseError was: " << error.description; | 316 << "SdpParseError was: " << error.description; |
316 return; | 317 return; |
317 } | 318 } |
318 if (!peer_connection_->AddIceCandidate(candidate.get())) { | 319 if (!peer_connection_->AddIceCandidate(candidate.get())) { |
319 LOG(WARNING) << "Failed to apply the received candidate"; | 320 LOG(WARNING) << "Failed to apply the received candidate"; |
320 return; | 321 return; |
321 } | 322 } |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
539 } | 540 } |
540 | 541 |
541 void Conductor::OnFailure(const std::string& error) { | 542 void Conductor::OnFailure(const std::string& error) { |
542 LOG(LERROR) << error; | 543 LOG(LERROR) << error; |
543 } | 544 } |
544 | 545 |
545 void Conductor::SendMessage(const std::string& json_object) { | 546 void Conductor::SendMessage(const std::string& json_object) { |
546 std::string* msg = new std::string(json_object); | 547 std::string* msg = new std::string(json_object); |
547 main_wnd_->QueueUIThreadCallback(SEND_MESSAGE_TO_PEER, msg); | 548 main_wnd_->QueueUIThreadCallback(SEND_MESSAGE_TO_PEER, msg); |
548 } | 549 } |
OLD | NEW |