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

Side by Side Diff: talk/app/webrtc/peerconnection.cc

Issue 1361273002: Reland of Adding PeerConnectionInterface::SetConfiguration method. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Fixing patch conflict. Created 5 years, 2 months 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
« no previous file with comments | « talk/app/webrtc/peerconnection.h ('k') | talk/app/webrtc/peerconnectioninterface.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 662 matching lines...) Expand 10 before | Expand all | Expand 10 after
673 } 673 }
674 674
675 void PeerConnection::PostSetSessionDescriptionFailure( 675 void PeerConnection::PostSetSessionDescriptionFailure(
676 SetSessionDescriptionObserver* observer, 676 SetSessionDescriptionObserver* observer,
677 const std::string& error) { 677 const std::string& error) {
678 SetSessionDescriptionMsg* msg = new SetSessionDescriptionMsg(observer); 678 SetSessionDescriptionMsg* msg = new SetSessionDescriptionMsg(observer);
679 msg->error = error; 679 msg->error = error;
680 signaling_thread()->Post(this, MSG_SET_SESSIONDESCRIPTION_FAILED, msg); 680 signaling_thread()->Post(this, MSG_SET_SESSIONDESCRIPTION_FAILED, msg);
681 } 681 }
682 682
683 bool PeerConnection::UpdateIce(const IceServers& configuration, 683 bool PeerConnection::SetConfiguration(const RTCConfiguration& config) {
684 const MediaConstraintsInterface* constraints) {
685 return false;
686 }
687
688 bool PeerConnection::UpdateIce(const RTCConfiguration& config) {
689 if (port_allocator_) { 684 if (port_allocator_) {
690 std::vector<PortAllocatorFactoryInterface::StunConfiguration> stuns; 685 std::vector<PortAllocatorFactoryInterface::StunConfiguration> stuns;
691 std::vector<PortAllocatorFactoryInterface::TurnConfiguration> turns; 686 std::vector<PortAllocatorFactoryInterface::TurnConfiguration> turns;
692 if (!ParseIceServers(config.servers, &stuns, &turns)) { 687 if (!ParseIceServers(config.servers, &stuns, &turns)) {
693 return false; 688 return false;
694 } 689 }
695 690
696 std::vector<rtc::SocketAddress> stun_hosts; 691 std::vector<rtc::SocketAddress> stun_hosts;
697 typedef std::vector<StunConfiguration>::const_iterator StunIt; 692 typedef std::vector<StunConfiguration>::const_iterator StunIt;
698 for (StunIt stun_it = stuns.begin(); stun_it != stuns.end(); ++stun_it) { 693 for (StunIt stun_it = stuns.begin(); stun_it != stuns.end(); ++stun_it) {
699 stun_hosts.push_back(stun_it->server); 694 stun_hosts.push_back(stun_it->server);
700 } 695 }
701 696
702 rtc::SocketAddress stun_addr; 697 rtc::SocketAddress stun_addr;
703 if (!stun_hosts.empty()) { 698 if (!stun_hosts.empty()) {
704 stun_addr = stun_hosts.front(); 699 stun_addr = stun_hosts.front();
705 LOG(LS_INFO) << "UpdateIce: StunServer Address: " << stun_addr.ToString(); 700 LOG(LS_INFO) << "SetConfiguration: StunServer Address: "
701 << stun_addr.ToString();
706 } 702 }
707 703
708 for (size_t i = 0; i < turns.size(); ++i) { 704 for (size_t i = 0; i < turns.size(); ++i) {
709 cricket::RelayCredentials credentials(turns[i].username, 705 cricket::RelayCredentials credentials(turns[i].username,
710 turns[i].password); 706 turns[i].password);
711 cricket::RelayServerConfig relay_server(cricket::RELAY_TURN); 707 cricket::RelayServerConfig relay_server(cricket::RELAY_TURN);
712 cricket::ProtocolType protocol; 708 cricket::ProtocolType protocol;
713 if (cricket::StringToProto(turns[i].transport_type.c_str(), &protocol)) { 709 if (cricket::StringToProto(turns[i].transport_type.c_str(), &protocol)) {
714 relay_server.ports.push_back(cricket::ProtocolAddress( 710 relay_server.ports.push_back(cricket::ProtocolAddress(
715 turns[i].server, protocol, turns[i].secure)); 711 turns[i].server, protocol, turns[i].secure));
716 relay_server.credentials = credentials; 712 relay_server.credentials = credentials;
717 LOG(LS_INFO) << "UpdateIce: TurnServer Address: " 713 LOG(LS_INFO) << "SetConfiguration: TurnServer Address: "
718 << turns[i].server.ToString(); 714 << turns[i].server.ToString();
719 } else { 715 } else {
720 LOG(LS_WARNING) << "Ignoring TURN server " << turns[i].server << ". " 716 LOG(LS_WARNING) << "Ignoring TURN server " << turns[i].server << ". "
721 << "Reason= Incorrect " << turns[i].transport_type 717 << "Reason= Incorrect " << turns[i].transport_type
722 << " transport parameter."; 718 << " transport parameter.";
723 } 719 }
724 } 720 }
725 } 721 }
726 session_->SetIceConfig(session_->ParseIceConfig(config)); 722 session_->SetIceConfig(session_->ParseIceConfig(config));
727 return session_->SetIceTransports(config.type); 723 return session_->SetIceTransports(config.type);
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
993 std::vector<rtc::scoped_refptr<RtpReceiverInterface>>::iterator 989 std::vector<rtc::scoped_refptr<RtpReceiverInterface>>::iterator
994 PeerConnection::FindReceiverForTrack(MediaStreamTrackInterface* track) { 990 PeerConnection::FindReceiverForTrack(MediaStreamTrackInterface* track) {
995 return std::find_if( 991 return std::find_if(
996 receivers_.begin(), receivers_.end(), 992 receivers_.begin(), receivers_.end(),
997 [track](const rtc::scoped_refptr<RtpReceiverInterface>& receiver) { 993 [track](const rtc::scoped_refptr<RtpReceiverInterface>& receiver) {
998 return receiver->track() == track; 994 return receiver->track() == track;
999 }); 995 });
1000 } 996 }
1001 997
1002 } // namespace webrtc 998 } // namespace webrtc
OLDNEW
« no previous file with comments | « talk/app/webrtc/peerconnection.h ('k') | talk/app/webrtc/peerconnectioninterface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698