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 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 id, nullptr, options, std::move(dtls_identity_store), false); | 189 id, nullptr, options, std::move(dtls_identity_store), false); |
190 } | 190 } |
191 | 191 |
192 ~PeerConnectionTestClient() { | 192 ~PeerConnectionTestClient() { |
193 } | 193 } |
194 | 194 |
195 void Negotiate() { Negotiate(true, true); } | 195 void Negotiate() { Negotiate(true, true); } |
196 | 196 |
197 void Negotiate(bool audio, bool video) { | 197 void Negotiate(bool audio, bool video) { |
198 rtc::scoped_ptr<SessionDescriptionInterface> offer; | 198 rtc::scoped_ptr<SessionDescriptionInterface> offer; |
199 ASSERT_TRUE(DoCreateOffer(offer.use())); | 199 ASSERT_TRUE(DoCreateOffer(&offer)); |
200 | 200 |
201 if (offer->description()->GetContentByName("audio")) { | 201 if (offer->description()->GetContentByName("audio")) { |
202 offer->description()->GetContentByName("audio")->rejected = !audio; | 202 offer->description()->GetContentByName("audio")->rejected = !audio; |
203 } | 203 } |
204 if (offer->description()->GetContentByName("video")) { | 204 if (offer->description()->GetContentByName("video")) { |
205 offer->description()->GetContentByName("video")->rejected = !video; | 205 offer->description()->GetContentByName("video")->rejected = !video; |
206 } | 206 } |
207 | 207 |
208 std::string sdp; | 208 std::string sdp; |
209 EXPECT_TRUE(offer->ToString(&sdp)); | 209 EXPECT_TRUE(offer->ToString(&sdp)); |
(...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
824 void HandleIncomingOffer(const std::string& msg) { | 824 void HandleIncomingOffer(const std::string& msg) { |
825 LOG(INFO) << id_ << "HandleIncomingOffer "; | 825 LOG(INFO) << id_ << "HandleIncomingOffer "; |
826 if (NumberOfLocalMediaStreams() == 0 && auto_add_stream_) { | 826 if (NumberOfLocalMediaStreams() == 0 && auto_add_stream_) { |
827 // If we are not sending any streams ourselves it is time to add some. | 827 // If we are not sending any streams ourselves it is time to add some. |
828 AddMediaStream(true, true); | 828 AddMediaStream(true, true); |
829 } | 829 } |
830 rtc::scoped_ptr<SessionDescriptionInterface> desc( | 830 rtc::scoped_ptr<SessionDescriptionInterface> desc( |
831 webrtc::CreateSessionDescription("offer", msg, nullptr)); | 831 webrtc::CreateSessionDescription("offer", msg, nullptr)); |
832 EXPECT_TRUE(DoSetRemoteDescription(desc.release())); | 832 EXPECT_TRUE(DoSetRemoteDescription(desc.release())); |
833 rtc::scoped_ptr<SessionDescriptionInterface> answer; | 833 rtc::scoped_ptr<SessionDescriptionInterface> answer; |
834 EXPECT_TRUE(DoCreateAnswer(answer.use())); | 834 EXPECT_TRUE(DoCreateAnswer(&answer)); |
835 std::string sdp; | 835 std::string sdp; |
836 EXPECT_TRUE(answer->ToString(&sdp)); | 836 EXPECT_TRUE(answer->ToString(&sdp)); |
837 EXPECT_TRUE(DoSetLocalDescription(answer.release())); | 837 EXPECT_TRUE(DoSetLocalDescription(answer.release())); |
838 if (signaling_message_receiver_) { | 838 if (signaling_message_receiver_) { |
839 signaling_message_receiver_->ReceiveSdpMessage( | 839 signaling_message_receiver_->ReceiveSdpMessage( |
840 webrtc::SessionDescriptionInterface::kAnswer, sdp); | 840 webrtc::SessionDescriptionInterface::kAnswer, sdp); |
841 } | 841 } |
842 } | 842 } |
843 | 843 |
844 void HandleIncomingAnswer(const std::string& msg) { | 844 void HandleIncomingAnswer(const std::string& msg) { |
845 LOG(INFO) << id_ << "HandleIncomingAnswer"; | 845 LOG(INFO) << id_ << "HandleIncomingAnswer"; |
846 rtc::scoped_ptr<SessionDescriptionInterface> desc( | 846 rtc::scoped_ptr<SessionDescriptionInterface> desc( |
847 webrtc::CreateSessionDescription("answer", msg, nullptr)); | 847 webrtc::CreateSessionDescription("answer", msg, nullptr)); |
848 EXPECT_TRUE(DoSetRemoteDescription(desc.release())); | 848 EXPECT_TRUE(DoSetRemoteDescription(desc.release())); |
849 } | 849 } |
850 | 850 |
851 bool DoCreateOfferAnswer(SessionDescriptionInterface** desc, | 851 bool DoCreateOfferAnswer(rtc::scoped_ptr<SessionDescriptionInterface>* desc, |
852 bool offer) { | 852 bool offer) { |
853 rtc::scoped_refptr<MockCreateSessionDescriptionObserver> | 853 rtc::scoped_refptr<MockCreateSessionDescriptionObserver> |
854 observer(new rtc::RefCountedObject< | 854 observer(new rtc::RefCountedObject< |
855 MockCreateSessionDescriptionObserver>()); | 855 MockCreateSessionDescriptionObserver>()); |
856 if (prefer_constraint_apis_) { | 856 if (prefer_constraint_apis_) { |
857 if (offer) { | 857 if (offer) { |
858 pc()->CreateOffer(observer, &offer_answer_constraints_); | 858 pc()->CreateOffer(observer, &offer_answer_constraints_); |
859 } else { | 859 } else { |
860 pc()->CreateAnswer(observer, &offer_answer_constraints_); | 860 pc()->CreateAnswer(observer, &offer_answer_constraints_); |
861 } | 861 } |
862 } else { | 862 } else { |
863 if (offer) { | 863 if (offer) { |
864 pc()->CreateOffer(observer, offer_answer_options_); | 864 pc()->CreateOffer(observer, offer_answer_options_); |
865 } else { | 865 } else { |
866 pc()->CreateAnswer(observer, offer_answer_options_); | 866 pc()->CreateAnswer(observer, offer_answer_options_); |
867 } | 867 } |
868 } | 868 } |
869 EXPECT_EQ_WAIT(true, observer->called(), kMaxWaitMs); | 869 EXPECT_EQ_WAIT(true, observer->called(), kMaxWaitMs); |
870 *desc = observer->release_desc(); | 870 desc->reset(observer->release_desc()); |
871 if (observer->result() && ExpectIceRestart()) { | 871 if (observer->result() && ExpectIceRestart()) { |
872 EXPECT_EQ(0u, (*desc)->candidates(0)->count()); | 872 EXPECT_EQ(0u, (*desc)->candidates(0)->count()); |
873 } | 873 } |
874 return observer->result(); | 874 return observer->result(); |
875 } | 875 } |
876 | 876 |
877 bool DoCreateOffer(SessionDescriptionInterface** desc) { | 877 bool DoCreateOffer(rtc::scoped_ptr<SessionDescriptionInterface>* desc) { |
878 return DoCreateOfferAnswer(desc, true); | 878 return DoCreateOfferAnswer(desc, true); |
879 } | 879 } |
880 | 880 |
881 bool DoCreateAnswer(SessionDescriptionInterface** desc) { | 881 bool DoCreateAnswer(rtc::scoped_ptr<SessionDescriptionInterface>* desc) { |
882 return DoCreateOfferAnswer(desc, false); | 882 return DoCreateOfferAnswer(desc, false); |
883 } | 883 } |
884 | 884 |
885 bool DoSetLocalDescription(SessionDescriptionInterface* desc) { | 885 bool DoSetLocalDescription(SessionDescriptionInterface* desc) { |
886 rtc::scoped_refptr<MockSetSessionDescriptionObserver> | 886 rtc::scoped_refptr<MockSetSessionDescriptionObserver> |
887 observer(new rtc::RefCountedObject< | 887 observer(new rtc::RefCountedObject< |
888 MockSetSessionDescriptionObserver>()); | 888 MockSetSessionDescriptionObserver>()); |
889 LOG(INFO) << id_ << "SetLocalDescription "; | 889 LOG(INFO) << id_ << "SetLocalDescription "; |
890 pc()->SetLocalDescription(observer, desc); | 890 pc()->SetLocalDescription(observer, desc); |
891 // Ignore the observer result. If we wait for the result with | 891 // Ignore the observer result. If we wait for the result with |
(...skipping 1195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2087 server.urls.push_back("turn:hostname2"); | 2087 server.urls.push_back("turn:hostname2"); |
2088 servers.push_back(server); | 2088 servers.push_back(server); |
2089 EXPECT_TRUE(webrtc::ParseIceServers(servers, &stun_servers_, &turn_servers_)); | 2089 EXPECT_TRUE(webrtc::ParseIceServers(servers, &stun_servers_, &turn_servers_)); |
2090 EXPECT_EQ(2U, turn_servers_.size()); | 2090 EXPECT_EQ(2U, turn_servers_.size()); |
2091 EXPECT_NE(turn_servers_[0].priority, turn_servers_[1].priority); | 2091 EXPECT_NE(turn_servers_[0].priority, turn_servers_[1].priority); |
2092 } | 2092 } |
2093 | 2093 |
2094 #endif // if !defined(THREAD_SANITIZER) | 2094 #endif // if !defined(THREAD_SANITIZER) |
2095 | 2095 |
2096 } // namespace | 2096 } // namespace |
OLD | NEW |