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, |
11 * this list of conditions and the following disclaimer in the documentation | 11 * this list of conditions and the following disclaimer in the documentation |
12 * and/or other materials provided with the distribution. | 12 * and/or other materials provided with the distribution. |
13 * 3. The name of the author may not be used to endorse or promote products | 13 * 3. The name of the author may not be used to endorse or promote products |
14 * derived from this software without specific prior written permission. | 14 * derived from this software without specific prior written permission. |
15 * | 15 * |
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED | 16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED |
17 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | 17 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
18 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO | 18 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO |
19 * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 19 * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
20 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | 20 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
21 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; | 21 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; |
22 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | 22 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
23 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | 23 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR |
24 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | 24 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF |
25 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 */ | 26 */ |
27 | 27 |
28 #include <string> | 28 #include <string> |
| 29 #include <utility> |
29 | 30 |
30 #include "talk/app/webrtc/audiotrack.h" | 31 #include "talk/app/webrtc/audiotrack.h" |
31 #include "talk/app/webrtc/fakeportallocatorfactory.h" | 32 #include "talk/app/webrtc/fakeportallocatorfactory.h" |
32 #include "talk/app/webrtc/jsepsessiondescription.h" | 33 #include "talk/app/webrtc/jsepsessiondescription.h" |
33 #include "talk/app/webrtc/mediastream.h" | 34 #include "talk/app/webrtc/mediastream.h" |
34 #include "talk/app/webrtc/mediastreaminterface.h" | 35 #include "talk/app/webrtc/mediastreaminterface.h" |
35 #include "talk/app/webrtc/peerconnection.h" | 36 #include "talk/app/webrtc/peerconnection.h" |
36 #include "talk/app/webrtc/peerconnectioninterface.h" | 37 #include "talk/app/webrtc/peerconnectioninterface.h" |
37 #include "talk/app/webrtc/rtpreceiverinterface.h" | 38 #include "talk/app/webrtc/rtpreceiverinterface.h" |
38 #include "talk/app/webrtc/rtpsenderinterface.h" | 39 #include "talk/app/webrtc/rtpsenderinterface.h" |
(...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
555 } | 556 } |
556 | 557 |
557 scoped_ptr<webrtc::DtlsIdentityStoreInterface> dtls_identity_store; | 558 scoped_ptr<webrtc::DtlsIdentityStoreInterface> dtls_identity_store; |
558 bool dtls; | 559 bool dtls; |
559 if (FindConstraint(constraints, | 560 if (FindConstraint(constraints, |
560 webrtc::MediaConstraintsInterface::kEnableDtlsSrtp, | 561 webrtc::MediaConstraintsInterface::kEnableDtlsSrtp, |
561 &dtls, | 562 &dtls, |
562 nullptr) && dtls) { | 563 nullptr) && dtls) { |
563 dtls_identity_store.reset(new FakeDtlsIdentityStore()); | 564 dtls_identity_store.reset(new FakeDtlsIdentityStore()); |
564 } | 565 } |
565 pc_ = pc_factory_->CreatePeerConnection(servers, constraints, | 566 pc_ = pc_factory_->CreatePeerConnection( |
566 port_allocator_factory_.get(), | 567 servers, constraints, port_allocator_factory_.get(), |
567 dtls_identity_store.Pass(), | 568 std::move(dtls_identity_store), &observer_); |
568 &observer_); | |
569 ASSERT_TRUE(pc_.get() != NULL); | 569 ASSERT_TRUE(pc_.get() != NULL); |
570 observer_.SetPeerConnectionInterface(pc_.get()); | 570 observer_.SetPeerConnectionInterface(pc_.get()); |
571 EXPECT_EQ(PeerConnectionInterface::kStable, observer_.state_); | 571 EXPECT_EQ(PeerConnectionInterface::kStable, observer_.state_); |
572 } | 572 } |
573 | 573 |
574 void CreatePeerConnectionExpectFail(const std::string& uri) { | 574 void CreatePeerConnectionExpectFail(const std::string& uri) { |
575 PeerConnectionInterface::IceServer server; | 575 PeerConnectionInterface::IceServer server; |
576 PeerConnectionInterface::IceServers servers; | 576 PeerConnectionInterface::IceServers servers; |
577 server.uri = uri; | 577 server.uri = uri; |
578 servers.push_back(server); | 578 servers.push_back(server); |
579 | 579 |
580 scoped_ptr<webrtc::DtlsIdentityStoreInterface> dtls_identity_store; | 580 scoped_ptr<webrtc::DtlsIdentityStoreInterface> dtls_identity_store; |
581 port_allocator_factory_ = FakePortAllocatorFactory::Create(); | 581 port_allocator_factory_ = FakePortAllocatorFactory::Create(); |
582 scoped_refptr<PeerConnectionInterface> pc; | 582 scoped_refptr<PeerConnectionInterface> pc; |
583 pc = pc_factory_->CreatePeerConnection( | 583 pc = pc_factory_->CreatePeerConnection( |
584 servers, nullptr, port_allocator_factory_.get(), | 584 servers, nullptr, port_allocator_factory_.get(), |
585 dtls_identity_store.Pass(), &observer_); | 585 std::move(dtls_identity_store), &observer_); |
586 ASSERT_EQ(nullptr, pc); | 586 ASSERT_EQ(nullptr, pc); |
587 } | 587 } |
588 | 588 |
589 void CreatePeerConnectionWithDifferentConfigurations() { | 589 void CreatePeerConnectionWithDifferentConfigurations() { |
590 CreatePeerConnection(kStunAddressOnly, "", NULL); | 590 CreatePeerConnection(kStunAddressOnly, "", NULL); |
591 EXPECT_EQ(1u, port_allocator_factory_->stun_configs().size()); | 591 EXPECT_EQ(1u, port_allocator_factory_->stun_configs().size()); |
592 EXPECT_EQ(0u, port_allocator_factory_->turn_configs().size()); | 592 EXPECT_EQ(0u, port_allocator_factory_->turn_configs().size()); |
593 EXPECT_EQ("address", | 593 EXPECT_EQ("address", |
594 port_allocator_factory_->stun_configs()[0].server.hostname()); | 594 port_allocator_factory_->stun_configs()[0].server.hostname()); |
595 EXPECT_EQ(kDefaultStunPort, | 595 EXPECT_EQ(kDefaultStunPort, |
(...skipping 1795 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2391 FakeConstraints updated_answer_c; | 2391 FakeConstraints updated_answer_c; |
2392 answer_c.SetMandatoryReceiveAudio(false); | 2392 answer_c.SetMandatoryReceiveAudio(false); |
2393 answer_c.SetMandatoryReceiveVideo(false); | 2393 answer_c.SetMandatoryReceiveVideo(false); |
2394 | 2394 |
2395 cricket::MediaSessionOptions updated_answer_options; | 2395 cricket::MediaSessionOptions updated_answer_options; |
2396 EXPECT_TRUE( | 2396 EXPECT_TRUE( |
2397 ParseConstraintsForAnswer(&updated_answer_c, &updated_answer_options)); | 2397 ParseConstraintsForAnswer(&updated_answer_c, &updated_answer_options)); |
2398 EXPECT_TRUE(updated_answer_options.has_audio()); | 2398 EXPECT_TRUE(updated_answer_options.has_audio()); |
2399 EXPECT_TRUE(updated_answer_options.has_video()); | 2399 EXPECT_TRUE(updated_answer_options.has_video()); |
2400 } | 2400 } |
OLD | NEW |