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 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
542 session_options->recv_video = | 542 session_options->recv_video = |
543 session_options->HasSendMediaStream(cricket::MEDIA_TYPE_VIDEO); | 543 session_options->HasSendMediaStream(cricket::MEDIA_TYPE_VIDEO); |
544 } | 544 } |
545 session_options->bundle_enabled = | 545 session_options->bundle_enabled = |
546 session_options->bundle_enabled && | 546 session_options->bundle_enabled && |
547 (session_options->has_audio() || session_options->has_video() || | 547 (session_options->has_audio() || session_options->has_video() || |
548 session_options->has_data()); | 548 session_options->has_data()); |
549 | 549 |
550 if (session_->data_channel_type() == cricket::DCT_SCTP && data_channel_) { | 550 if (session_->data_channel_type() == cricket::DCT_SCTP && data_channel_) { |
551 session_options->data_channel_type = cricket::DCT_SCTP; | 551 session_options->data_channel_type = cricket::DCT_SCTP; |
552 } else if (session_->data_channel_type() == cricket::DCT_QUIC) { | |
553 session_options->data_channel_type = cricket::DCT_QUIC; | |
552 } | 554 } |
553 } | 555 } |
554 | 556 |
555 void GetOptionsForAnswer(cricket::MediaSessionOptions* session_options) { | 557 void GetOptionsForAnswer(cricket::MediaSessionOptions* session_options) { |
556 // ParseConstraintsForAnswer is used to set some defaults. | 558 // ParseConstraintsForAnswer is used to set some defaults. |
557 ASSERT_TRUE(webrtc::ParseConstraintsForAnswer(nullptr, session_options)); | 559 ASSERT_TRUE(webrtc::ParseConstraintsForAnswer(nullptr, session_options)); |
558 | 560 |
559 AddStreamsToOptions(session_options); | 561 AddStreamsToOptions(session_options); |
560 session_options->bundle_enabled = | 562 session_options->bundle_enabled = |
561 session_options->bundle_enabled && | 563 session_options->bundle_enabled && |
562 (session_options->has_audio() || session_options->has_video() || | 564 (session_options->has_audio() || session_options->has_video() || |
563 session_options->has_data()); | 565 session_options->has_data()); |
564 | 566 |
565 if (session_->data_channel_type() == cricket::DCT_SCTP) { | 567 if (session_->data_channel_type() == cricket::DCT_SCTP) { |
566 session_options->data_channel_type = cricket::DCT_SCTP; | 568 session_options->data_channel_type = cricket::DCT_SCTP; |
569 } else if (session_->data_channel_type() == cricket::DCT_QUIC) { | |
570 session_options->data_channel_type = cricket::DCT_QUIC; | |
567 } | 571 } |
568 } | 572 } |
569 | 573 |
570 // Creates a local offer and applies it. Starts ICE. | 574 // Creates a local offer and applies it. Starts ICE. |
571 // Call SendAudioVideoStreamX() before this function | 575 // Call SendAudioVideoStreamX() before this function |
572 // to decide which streams to create. | 576 // to decide which streams to create. |
573 void InitiateCall() { | 577 void InitiateCall() { |
574 SessionDescriptionInterface* offer = CreateOffer(); | 578 SessionDescriptionInterface* offer = CreateOffer(); |
575 SetLocalDescriptionWithoutError(offer); | 579 SetLocalDescriptionWithoutError(offer); |
576 EXPECT_TRUE_WAIT(PeerConnectionInterface::kIceGatheringNew != | 580 EXPECT_TRUE_WAIT(PeerConnectionInterface::kIceGatheringNew != |
(...skipping 3724 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4301 candidate1.set_address(rtc::SocketAddress("1.1.1.1", 5000)); | 4305 candidate1.set_address(rtc::SocketAddress("1.1.1.1", 5000)); |
4302 candidate1.set_component(1); | 4306 candidate1.set_component(1); |
4303 JsepIceCandidate ice_candidate(kMediaContentName1, kMediaContentIndex1, | 4307 JsepIceCandidate ice_candidate(kMediaContentName1, kMediaContentIndex1, |
4304 candidate1); | 4308 candidate1); |
4305 EXPECT_TRUE(session_->ProcessIceMessage(&ice_candidate)); | 4309 EXPECT_TRUE(session_->ProcessIceMessage(&ice_candidate)); |
4306 | 4310 |
4307 answer = CreateAnswer(); | 4311 answer = CreateAnswer(); |
4308 SetLocalDescriptionWithoutError(answer); | 4312 SetLocalDescriptionWithoutError(answer); |
4309 } | 4313 } |
4310 | 4314 |
4315 #ifdef HAVE_QUIC | |
4316 TEST_P(WebRtcSessionTest, TestUseQuic) { | |
Taylor Brandstetter
2016/06/29 17:50:04
Maybe "TestNegotiateQuic" would be a better name,
| |
4317 configuration_.enable_quic = true; | |
4318 InitWithDtls(GetParam()); | |
4319 EXPECT_TRUE(session_->data_channel_type() == cricket::DCT_QUIC); | |
4320 SessionDescriptionInterface* offer = CreateOffer(); | |
4321 ASSERT_TRUE(offer); | |
4322 ASSERT_TRUE(offer->description()); | |
4323 SetLocalDescriptionWithoutError(offer); | |
4324 cricket::MediaSessionOptions options; | |
4325 options.recv_audio = true; | |
4326 options.recv_video = true; | |
4327 SessionDescriptionInterface* answer = | |
4328 CreateRemoteAnswer(offer, options, cricket::SEC_DISABLED); | |
4329 ASSERT_TRUE(answer); | |
4330 ASSERT_TRUE(answer->description()); | |
4331 SetRemoteDescriptionWithoutError(answer); | |
4332 } | |
4333 #endif // HAVE_QUIC | |
4334 | |
4311 // Tests that RTX codec is removed from the answer when it isn't supported | 4335 // Tests that RTX codec is removed from the answer when it isn't supported |
4312 // by local side. | 4336 // by local side. |
4313 TEST_F(WebRtcSessionTest, TestRtxRemovedByCreateAnswer) { | 4337 TEST_F(WebRtcSessionTest, TestRtxRemovedByCreateAnswer) { |
4314 Init(); | 4338 Init(); |
4315 SendAudioVideoStream1(); | 4339 SendAudioVideoStream1(); |
4316 std::string offer_sdp(kSdpWithRtx); | 4340 std::string offer_sdp(kSdpWithRtx); |
4317 | 4341 |
4318 SessionDescriptionInterface* offer = | 4342 SessionDescriptionInterface* offer = |
4319 CreateSessionDescription(JsepSessionDescription::kOffer, offer_sdp, NULL); | 4343 CreateSessionDescription(JsepSessionDescription::kOffer, offer_sdp, NULL); |
4320 EXPECT_TRUE(offer->ToString(&offer_sdp)); | 4344 EXPECT_TRUE(offer->ToString(&offer_sdp)); |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4419 } | 4443 } |
4420 | 4444 |
4421 // TODO(bemasc): Add a TestIceStatesBundle with BUNDLE enabled. That test | 4445 // TODO(bemasc): Add a TestIceStatesBundle with BUNDLE enabled. That test |
4422 // currently fails because upon disconnection and reconnection OnIceComplete is | 4446 // currently fails because upon disconnection and reconnection OnIceComplete is |
4423 // called more than once without returning to IceGatheringGathering. | 4447 // called more than once without returning to IceGatheringGathering. |
4424 | 4448 |
4425 INSTANTIATE_TEST_CASE_P(WebRtcSessionTests, | 4449 INSTANTIATE_TEST_CASE_P(WebRtcSessionTests, |
4426 WebRtcSessionTest, | 4450 WebRtcSessionTest, |
4427 testing::Values(ALREADY_GENERATED, | 4451 testing::Values(ALREADY_GENERATED, |
4428 DTLS_IDENTITY_STORE)); | 4452 DTLS_IDENTITY_STORE)); |
OLD | NEW |