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 530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
541 session_options->recv_video = | 541 session_options->recv_video = |
542 session_options->HasSendMediaStream(cricket::MEDIA_TYPE_VIDEO); | 542 session_options->HasSendMediaStream(cricket::MEDIA_TYPE_VIDEO); |
543 } | 543 } |
544 session_options->bundle_enabled = | 544 session_options->bundle_enabled = |
545 session_options->bundle_enabled && | 545 session_options->bundle_enabled && |
546 (session_options->has_audio() || session_options->has_video() || | 546 (session_options->has_audio() || session_options->has_video() || |
547 session_options->has_data()); | 547 session_options->has_data()); |
548 | 548 |
549 if (session_->data_channel_type() == cricket::DCT_SCTP && data_channel_) { | 549 if (session_->data_channel_type() == cricket::DCT_SCTP && data_channel_) { |
550 session_options->data_channel_type = cricket::DCT_SCTP; | 550 session_options->data_channel_type = cricket::DCT_SCTP; |
| 551 } else if (session_->data_channel_type() == cricket::DCT_QUIC) { |
| 552 session_options->data_channel_type = cricket::DCT_QUIC; |
551 } | 553 } |
552 } | 554 } |
553 | 555 |
554 void GetOptionsForAnswer(cricket::MediaSessionOptions* session_options) { | 556 void GetOptionsForAnswer(cricket::MediaSessionOptions* session_options) { |
555 // ParseConstraintsForAnswer is used to set some defaults. | 557 // ParseConstraintsForAnswer is used to set some defaults. |
556 ASSERT_TRUE(webrtc::ParseConstraintsForAnswer(nullptr, session_options)); | 558 ASSERT_TRUE(webrtc::ParseConstraintsForAnswer(nullptr, session_options)); |
557 | 559 |
558 AddStreamsToOptions(session_options); | 560 AddStreamsToOptions(session_options); |
559 session_options->bundle_enabled = | 561 session_options->bundle_enabled = |
560 session_options->bundle_enabled && | 562 session_options->bundle_enabled && |
561 (session_options->has_audio() || session_options->has_video() || | 563 (session_options->has_audio() || session_options->has_video() || |
562 session_options->has_data()); | 564 session_options->has_data()); |
563 | 565 |
564 if (session_->data_channel_type() == cricket::DCT_SCTP) { | 566 if (session_->data_channel_type() == cricket::DCT_SCTP) { |
565 session_options->data_channel_type = cricket::DCT_SCTP; | 567 session_options->data_channel_type = cricket::DCT_SCTP; |
| 568 } else if (session_->data_channel_type() == cricket::DCT_QUIC) { |
| 569 session_options->data_channel_type = cricket::DCT_QUIC; |
566 } | 570 } |
567 } | 571 } |
568 | 572 |
569 // Creates a local offer and applies it. Starts ICE. | 573 // Creates a local offer and applies it. Starts ICE. |
570 // Call SendAudioVideoStreamX() before this function | 574 // Call SendAudioVideoStreamX() before this function |
571 // to decide which streams to create. | 575 // to decide which streams to create. |
572 void InitiateCall() { | 576 void InitiateCall() { |
573 SessionDescriptionInterface* offer = CreateOffer(); | 577 SessionDescriptionInterface* offer = CreateOffer(); |
574 SetLocalDescriptionWithoutError(offer); | 578 SetLocalDescriptionWithoutError(offer); |
575 EXPECT_TRUE_WAIT(PeerConnectionInterface::kIceGatheringNew != | 579 EXPECT_TRUE_WAIT(PeerConnectionInterface::kIceGatheringNew != |
(...skipping 3694 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4270 candidate1.set_address(rtc::SocketAddress("1.1.1.1", 5000)); | 4274 candidate1.set_address(rtc::SocketAddress("1.1.1.1", 5000)); |
4271 candidate1.set_component(1); | 4275 candidate1.set_component(1); |
4272 JsepIceCandidate ice_candidate(kMediaContentName1, kMediaContentIndex1, | 4276 JsepIceCandidate ice_candidate(kMediaContentName1, kMediaContentIndex1, |
4273 candidate1); | 4277 candidate1); |
4274 EXPECT_TRUE(session_->ProcessIceMessage(&ice_candidate)); | 4278 EXPECT_TRUE(session_->ProcessIceMessage(&ice_candidate)); |
4275 | 4279 |
4276 answer = CreateAnswer(); | 4280 answer = CreateAnswer(); |
4277 SetLocalDescriptionWithoutError(answer); | 4281 SetLocalDescriptionWithoutError(answer); |
4278 } | 4282 } |
4279 | 4283 |
| 4284 #ifdef HAVE_QUIC |
| 4285 TEST_P(WebRtcSessionTest, TestUseQuic) { |
| 4286 configuration_.enable_quic = true; |
| 4287 InitWithDtls(GetParam()); |
| 4288 EXPECT_TRUE(session_->data_channel_type() == cricket::DCT_QUIC); |
| 4289 SessionDescriptionInterface* offer = CreateOffer(); |
| 4290 ASSERT_TRUE(offer); |
| 4291 ASSERT_TRUE(offer->description()); |
| 4292 SetLocalDescriptionWithoutError(offer); |
| 4293 cricket::MediaSessionOptions options; |
| 4294 options.recv_audio = true; |
| 4295 options.recv_video = true; |
| 4296 SessionDescriptionInterface* answer = |
| 4297 CreateRemoteAnswer(offer, options, cricket::SEC_DISABLED); |
| 4298 ASSERT_TRUE(answer); |
| 4299 ASSERT_TRUE(answer->description()); |
| 4300 SetRemoteDescriptionWithoutError(answer); |
| 4301 } |
| 4302 #endif // HAVE_QUIC |
| 4303 |
4280 // Flaky on Win and Mac only. See webrtc:4943 | 4304 // Flaky on Win and Mac only. See webrtc:4943 |
4281 #if defined(WEBRTC_WIN) || defined(WEBRTC_MAC) | 4305 #if defined(WEBRTC_WIN) || defined(WEBRTC_MAC) |
4282 #define MAYBE_TestRtxRemovedByCreateAnswer DISABLED_TestRtxRemovedByCreateAnswer | 4306 #define MAYBE_TestRtxRemovedByCreateAnswer DISABLED_TestRtxRemovedByCreateAnswer |
4283 #else | 4307 #else |
4284 #define MAYBE_TestRtxRemovedByCreateAnswer TestRtxRemovedByCreateAnswer | 4308 #define MAYBE_TestRtxRemovedByCreateAnswer TestRtxRemovedByCreateAnswer |
4285 #endif | 4309 #endif |
4286 // Tests that RTX codec is removed from the answer when it isn't supported | 4310 // Tests that RTX codec is removed from the answer when it isn't supported |
4287 // by local side. | 4311 // by local side. |
4288 TEST_F(WebRtcSessionTest, MAYBE_TestRtxRemovedByCreateAnswer) { | 4312 TEST_F(WebRtcSessionTest, MAYBE_TestRtxRemovedByCreateAnswer) { |
4289 Init(); | 4313 Init(); |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4396 } | 4420 } |
4397 | 4421 |
4398 // TODO(bemasc): Add a TestIceStatesBundle with BUNDLE enabled. That test | 4422 // TODO(bemasc): Add a TestIceStatesBundle with BUNDLE enabled. That test |
4399 // currently fails because upon disconnection and reconnection OnIceComplete is | 4423 // currently fails because upon disconnection and reconnection OnIceComplete is |
4400 // called more than once without returning to IceGatheringGathering. | 4424 // called more than once without returning to IceGatheringGathering. |
4401 | 4425 |
4402 INSTANTIATE_TEST_CASE_P(WebRtcSessionTests, | 4426 INSTANTIATE_TEST_CASE_P(WebRtcSessionTests, |
4403 WebRtcSessionTest, | 4427 WebRtcSessionTest, |
4404 testing::Values(ALREADY_GENERATED, | 4428 testing::Values(ALREADY_GENERATED, |
4405 DTLS_IDENTITY_STORE)); | 4429 DTLS_IDENTITY_STORE)); |
OLD | NEW |