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 3701 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4277 candidate1.set_address(rtc::SocketAddress("1.1.1.1", 5000)); | 4281 candidate1.set_address(rtc::SocketAddress("1.1.1.1", 5000)); |
4278 candidate1.set_component(1); | 4282 candidate1.set_component(1); |
4279 JsepIceCandidate ice_candidate(kMediaContentName1, kMediaContentIndex1, | 4283 JsepIceCandidate ice_candidate(kMediaContentName1, kMediaContentIndex1, |
4280 candidate1); | 4284 candidate1); |
4281 EXPECT_TRUE(session_->ProcessIceMessage(&ice_candidate)); | 4285 EXPECT_TRUE(session_->ProcessIceMessage(&ice_candidate)); |
4282 | 4286 |
4283 answer = CreateAnswer(); | 4287 answer = CreateAnswer(); |
4284 SetLocalDescriptionWithoutError(answer); | 4288 SetLocalDescriptionWithoutError(answer); |
4285 } | 4289 } |
4286 | 4290 |
| 4291 #ifdef HAVE_QUIC |
| 4292 TEST_P(WebRtcSessionTest, TestUseQuic) { |
| 4293 configuration_.enable_quic = true; |
| 4294 InitWithDtls(GetParam()); |
| 4295 EXPECT_TRUE(session_->data_channel_type() == cricket::DCT_QUIC); |
| 4296 SessionDescriptionInterface* offer = CreateOffer(); |
| 4297 ASSERT_TRUE(offer); |
| 4298 ASSERT_TRUE(offer->description()); |
| 4299 SetLocalDescriptionWithoutError(offer); |
| 4300 cricket::MediaSessionOptions options; |
| 4301 options.recv_audio = true; |
| 4302 options.recv_video = true; |
| 4303 SessionDescriptionInterface* answer = |
| 4304 CreateRemoteAnswer(offer, options, cricket::SEC_DISABLED); |
| 4305 ASSERT_TRUE(answer); |
| 4306 ASSERT_TRUE(answer->description()); |
| 4307 SetRemoteDescriptionWithoutError(answer); |
| 4308 } |
| 4309 #endif // HAVE_QUIC |
| 4310 |
4287 // Flaky on Win and Mac only. See webrtc:4943 | 4311 // Flaky on Win and Mac only. See webrtc:4943 |
4288 #if defined(WEBRTC_WIN) || defined(WEBRTC_MAC) | 4312 #if defined(WEBRTC_WIN) || defined(WEBRTC_MAC) |
4289 #define MAYBE_TestRtxRemovedByCreateAnswer DISABLED_TestRtxRemovedByCreateAnswer | 4313 #define MAYBE_TestRtxRemovedByCreateAnswer DISABLED_TestRtxRemovedByCreateAnswer |
4290 #else | 4314 #else |
4291 #define MAYBE_TestRtxRemovedByCreateAnswer TestRtxRemovedByCreateAnswer | 4315 #define MAYBE_TestRtxRemovedByCreateAnswer TestRtxRemovedByCreateAnswer |
4292 #endif | 4316 #endif |
4293 // Tests that RTX codec is removed from the answer when it isn't supported | 4317 // Tests that RTX codec is removed from the answer when it isn't supported |
4294 // by local side. | 4318 // by local side. |
4295 TEST_F(WebRtcSessionTest, MAYBE_TestRtxRemovedByCreateAnswer) { | 4319 TEST_F(WebRtcSessionTest, MAYBE_TestRtxRemovedByCreateAnswer) { |
4296 Init(); | 4320 Init(); |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4403 } | 4427 } |
4404 | 4428 |
4405 // TODO(bemasc): Add a TestIceStatesBundle with BUNDLE enabled. That test | 4429 // TODO(bemasc): Add a TestIceStatesBundle with BUNDLE enabled. That test |
4406 // currently fails because upon disconnection and reconnection OnIceComplete is | 4430 // currently fails because upon disconnection and reconnection OnIceComplete is |
4407 // called more than once without returning to IceGatheringGathering. | 4431 // called more than once without returning to IceGatheringGathering. |
4408 | 4432 |
4409 INSTANTIATE_TEST_CASE_P(WebRtcSessionTests, | 4433 INSTANTIATE_TEST_CASE_P(WebRtcSessionTests, |
4410 WebRtcSessionTest, | 4434 WebRtcSessionTest, |
4411 testing::Values(ALREADY_GENERATED, | 4435 testing::Values(ALREADY_GENERATED, |
4412 DTLS_IDENTITY_STORE)); | 4436 DTLS_IDENTITY_STORE)); |
OLD | NEW |