OLD | NEW |
---|---|
1 /* | 1 /* |
2 * libjingle | 2 * libjingle |
3 * Copyright 2012 Google Inc. | 3 * Copyright 2012 Google Inc. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
296 return; | 296 return; |
297 } | 297 } |
298 | 298 |
299 std::string sdp; | 299 std::string sdp; |
300 if (!rtc::GetStringFromJsonObject(jmessage, kSessionDescriptionSdpName, | 300 if (!rtc::GetStringFromJsonObject(jmessage, kSessionDescriptionSdpName, |
301 &sdp)) { | 301 &sdp)) { |
302 LOG(WARNING) << "Can't parse received session description message."; | 302 LOG(WARNING) << "Can't parse received session description message."; |
303 return; | 303 return; |
304 } | 304 } |
305 webrtc::SessionDescriptionInterface* session_description( | 305 webrtc::SessionDescriptionInterface* session_description( |
306 webrtc::CreateSessionDescription(type, sdp)); | 306 webrtc::CreateSessionDescription(type, sdp, nullptr)); |
pthatcher1
2015/07/16 04:41:31
Can you introduce a local variable to give the val
joachim
2015/07/16 08:12:00
Done, also changed to log the error description.
| |
307 if (!session_description) { | 307 if (!session_description) { |
308 LOG(WARNING) << "Can't parse received session description message."; | 308 LOG(WARNING) << "Can't parse received session description message."; |
309 return; | 309 return; |
310 } | 310 } |
311 LOG(INFO) << " Received session description :" << message; | 311 LOG(INFO) << " Received session description :" << message; |
312 peer_connection_->SetRemoteDescription( | 312 peer_connection_->SetRemoteDescription( |
313 DummySetSessionDescriptionObserver::Create(), session_description); | 313 DummySetSessionDescriptionObserver::Create(), session_description); |
314 if (session_description->type() == | 314 if (session_description->type() == |
315 webrtc::SessionDescriptionInterface::kOffer) { | 315 webrtc::SessionDescriptionInterface::kOffer) { |
316 peer_connection_->CreateAnswer(this, NULL); | 316 peer_connection_->CreateAnswer(this, NULL); |
317 } | 317 } |
318 return; | 318 return; |
319 } else { | 319 } else { |
320 std::string sdp_mid; | 320 std::string sdp_mid; |
321 int sdp_mlineindex = 0; | 321 int sdp_mlineindex = 0; |
322 std::string sdp; | 322 std::string sdp; |
323 if (!rtc::GetStringFromJsonObject(jmessage, kCandidateSdpMidName, | 323 if (!rtc::GetStringFromJsonObject(jmessage, kCandidateSdpMidName, |
324 &sdp_mid) || | 324 &sdp_mid) || |
325 !rtc::GetIntFromJsonObject(jmessage, kCandidateSdpMlineIndexName, | 325 !rtc::GetIntFromJsonObject(jmessage, kCandidateSdpMlineIndexName, |
326 &sdp_mlineindex) || | 326 &sdp_mlineindex) || |
327 !rtc::GetStringFromJsonObject(jmessage, kCandidateSdpName, &sdp)) { | 327 !rtc::GetStringFromJsonObject(jmessage, kCandidateSdpName, &sdp)) { |
328 LOG(WARNING) << "Can't parse received message."; | 328 LOG(WARNING) << "Can't parse received message."; |
329 return; | 329 return; |
330 } | 330 } |
331 rtc::scoped_ptr<webrtc::IceCandidateInterface> candidate( | 331 rtc::scoped_ptr<webrtc::IceCandidateInterface> candidate( |
332 webrtc::CreateIceCandidate(sdp_mid, sdp_mlineindex, sdp)); | 332 webrtc::CreateIceCandidate(sdp_mid, sdp_mlineindex, sdp, nullptr)); |
333 if (!candidate.get()) { | 333 if (!candidate.get()) { |
334 LOG(WARNING) << "Can't parse received candidate message."; | 334 LOG(WARNING) << "Can't parse received candidate message."; |
335 return; | 335 return; |
336 } | 336 } |
337 if (!peer_connection_->AddIceCandidate(candidate.get())) { | 337 if (!peer_connection_->AddIceCandidate(candidate.get())) { |
338 LOG(WARNING) << "Failed to apply the received candidate"; | 338 LOG(WARNING) << "Failed to apply the received candidate"; |
339 return; | 339 return; |
340 } | 340 } |
341 LOG(INFO) << " Received candidate :" << message; | 341 LOG(INFO) << " Received candidate :" << message; |
342 return; | 342 return; |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
529 peer_connection_->SetLocalDescription( | 529 peer_connection_->SetLocalDescription( |
530 DummySetSessionDescriptionObserver::Create(), desc); | 530 DummySetSessionDescriptionObserver::Create(), desc); |
531 | 531 |
532 std::string sdp; | 532 std::string sdp; |
533 desc->ToString(&sdp); | 533 desc->ToString(&sdp); |
534 | 534 |
535 // For loopback test. To save some connecting delay. | 535 // For loopback test. To save some connecting delay. |
536 if (loopback_) { | 536 if (loopback_) { |
537 // Replace message type from "offer" to "answer" | 537 // Replace message type from "offer" to "answer" |
538 webrtc::SessionDescriptionInterface* session_description( | 538 webrtc::SessionDescriptionInterface* session_description( |
539 webrtc::CreateSessionDescription("answer", sdp)); | 539 webrtc::CreateSessionDescription("answer", sdp, nullptr)); |
540 peer_connection_->SetRemoteDescription( | 540 peer_connection_->SetRemoteDescription( |
541 DummySetSessionDescriptionObserver::Create(), session_description); | 541 DummySetSessionDescriptionObserver::Create(), session_description); |
542 return; | 542 return; |
543 } | 543 } |
544 | 544 |
545 Json::StyledWriter writer; | 545 Json::StyledWriter writer; |
546 Json::Value jmessage; | 546 Json::Value jmessage; |
547 jmessage[kSessionDescriptionTypeName] = desc->type(); | 547 jmessage[kSessionDescriptionTypeName] = desc->type(); |
548 jmessage[kSessionDescriptionSdpName] = sdp; | 548 jmessage[kSessionDescriptionSdpName] = sdp; |
549 SendMessage(writer.write(jmessage)); | 549 SendMessage(writer.write(jmessage)); |
550 } | 550 } |
551 | 551 |
552 void Conductor::OnFailure(const std::string& error) { | 552 void Conductor::OnFailure(const std::string& error) { |
553 LOG(LERROR) << error; | 553 LOG(LERROR) << error; |
554 } | 554 } |
555 | 555 |
556 void Conductor::SendMessage(const std::string& json_object) { | 556 void Conductor::SendMessage(const std::string& json_object) { |
557 std::string* msg = new std::string(json_object); | 557 std::string* msg = new std::string(json_object); |
558 main_wnd_->QueueUIThreadCallback(SEND_MESSAGE_TO_PEER, msg); | 558 main_wnd_->QueueUIThreadCallback(SEND_MESSAGE_TO_PEER, msg); |
559 } | 559 } |
OLD | NEW |