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 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
551 session_options->recv_video = | 551 session_options->recv_video = |
552 session_options->HasSendMediaStream(cricket::MEDIA_TYPE_VIDEO); | 552 session_options->HasSendMediaStream(cricket::MEDIA_TYPE_VIDEO); |
553 } | 553 } |
554 session_options->bundle_enabled = | 554 session_options->bundle_enabled = |
555 session_options->bundle_enabled && | 555 session_options->bundle_enabled && |
556 (session_options->has_audio() || session_options->has_video() || | 556 (session_options->has_audio() || session_options->has_video() || |
557 session_options->has_data()); | 557 session_options->has_data()); |
558 | 558 |
559 if (session_->data_channel_type() == cricket::DCT_SCTP && data_channel_) { | 559 if (session_->data_channel_type() == cricket::DCT_SCTP && data_channel_) { |
560 session_options->data_channel_type = cricket::DCT_SCTP; | 560 session_options->data_channel_type = cricket::DCT_SCTP; |
| 561 } else if (session_->data_channel_type() == cricket::DCT_QUIC) { |
| 562 session_options->data_channel_type = cricket::DCT_QUIC; |
561 } | 563 } |
562 | 564 |
563 if (with_gcm_) { | 565 if (with_gcm_) { |
564 session_options->crypto_options.enable_gcm_crypto_suites = true; | 566 session_options->crypto_options.enable_gcm_crypto_suites = true; |
565 } | 567 } |
566 } | 568 } |
567 | 569 |
568 void GetOptionsForAnswer(cricket::MediaSessionOptions* session_options) { | 570 void GetOptionsForAnswer(cricket::MediaSessionOptions* session_options) { |
569 // ParseConstraintsForAnswer is used to set some defaults. | 571 // ParseConstraintsForAnswer is used to set some defaults. |
570 ASSERT_TRUE(webrtc::ParseConstraintsForAnswer(nullptr, session_options)); | 572 ASSERT_TRUE(webrtc::ParseConstraintsForAnswer(nullptr, session_options)); |
571 | 573 |
572 AddStreamsToOptions(session_options); | 574 AddStreamsToOptions(session_options); |
573 session_options->bundle_enabled = | 575 session_options->bundle_enabled = |
574 session_options->bundle_enabled && | 576 session_options->bundle_enabled && |
575 (session_options->has_audio() || session_options->has_video() || | 577 (session_options->has_audio() || session_options->has_video() || |
576 session_options->has_data()); | 578 session_options->has_data()); |
577 | 579 |
578 if (session_->data_channel_type() == cricket::DCT_SCTP) { | 580 session_options->data_channel_type = session_->data_channel_type(); |
579 session_options->data_channel_type = cricket::DCT_SCTP; | |
580 } | |
581 | 581 |
582 if (with_gcm_) { | 582 if (with_gcm_) { |
583 session_options->crypto_options.enable_gcm_crypto_suites = true; | 583 session_options->crypto_options.enable_gcm_crypto_suites = true; |
584 } | 584 } |
585 } | 585 } |
586 | 586 |
587 // Creates a local offer and applies it. Starts ICE. | 587 // Creates a local offer and applies it. Starts ICE. |
588 // Call SendAudioVideoStreamX() before this function | 588 // Call SendAudioVideoStreamX() before this function |
589 // to decide which streams to create. | 589 // to decide which streams to create. |
590 void InitiateCall() { | 590 void InitiateCall() { |
(...skipping 3614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4205 candidate1.set_address(rtc::SocketAddress("1.1.1.1", 5000)); | 4205 candidate1.set_address(rtc::SocketAddress("1.1.1.1", 5000)); |
4206 candidate1.set_component(1); | 4206 candidate1.set_component(1); |
4207 JsepIceCandidate ice_candidate(kMediaContentName1, kMediaContentIndex1, | 4207 JsepIceCandidate ice_candidate(kMediaContentName1, kMediaContentIndex1, |
4208 candidate1); | 4208 candidate1); |
4209 EXPECT_TRUE(session_->ProcessIceMessage(&ice_candidate)); | 4209 EXPECT_TRUE(session_->ProcessIceMessage(&ice_candidate)); |
4210 | 4210 |
4211 answer = CreateAnswer(); | 4211 answer = CreateAnswer(); |
4212 SetLocalDescriptionWithoutError(answer); | 4212 SetLocalDescriptionWithoutError(answer); |
4213 } | 4213 } |
4214 | 4214 |
| 4215 #ifdef HAVE_QUIC |
| 4216 TEST_P(WebRtcSessionTest, TestNegotiateQuic) { |
| 4217 configuration_.enable_quic = true; |
| 4218 InitWithDtls(GetParam()); |
| 4219 EXPECT_TRUE(session_->data_channel_type() == cricket::DCT_QUIC); |
| 4220 SessionDescriptionInterface* offer = CreateOffer(); |
| 4221 ASSERT_TRUE(offer); |
| 4222 ASSERT_TRUE(offer->description()); |
| 4223 SetLocalDescriptionWithoutError(offer); |
| 4224 cricket::MediaSessionOptions options; |
| 4225 options.recv_audio = true; |
| 4226 options.recv_video = true; |
| 4227 SessionDescriptionInterface* answer = |
| 4228 CreateRemoteAnswer(offer, options, cricket::SEC_DISABLED); |
| 4229 ASSERT_TRUE(answer); |
| 4230 ASSERT_TRUE(answer->description()); |
| 4231 SetRemoteDescriptionWithoutError(answer); |
| 4232 } |
| 4233 #endif // HAVE_QUIC |
| 4234 |
4215 // Tests that RTX codec is removed from the answer when it isn't supported | 4235 // Tests that RTX codec is removed from the answer when it isn't supported |
4216 // by local side. | 4236 // by local side. |
4217 TEST_F(WebRtcSessionTest, TestRtxRemovedByCreateAnswer) { | 4237 TEST_F(WebRtcSessionTest, TestRtxRemovedByCreateAnswer) { |
4218 Init(); | 4238 Init(); |
4219 SendAudioVideoStream1(); | 4239 SendAudioVideoStream1(); |
4220 std::string offer_sdp(kSdpWithRtx); | 4240 std::string offer_sdp(kSdpWithRtx); |
4221 | 4241 |
4222 SessionDescriptionInterface* offer = | 4242 SessionDescriptionInterface* offer = |
4223 CreateSessionDescription(JsepSessionDescription::kOffer, offer_sdp, NULL); | 4243 CreateSessionDescription(JsepSessionDescription::kOffer, offer_sdp, NULL); |
4224 EXPECT_TRUE(offer->ToString(&offer_sdp)); | 4244 EXPECT_TRUE(offer->ToString(&offer_sdp)); |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4323 } | 4343 } |
4324 | 4344 |
4325 // TODO(bemasc): Add a TestIceStatesBundle with BUNDLE enabled. That test | 4345 // TODO(bemasc): Add a TestIceStatesBundle with BUNDLE enabled. That test |
4326 // currently fails because upon disconnection and reconnection OnIceComplete is | 4346 // currently fails because upon disconnection and reconnection OnIceComplete is |
4327 // called more than once without returning to IceGatheringGathering. | 4347 // called more than once without returning to IceGatheringGathering. |
4328 | 4348 |
4329 INSTANTIATE_TEST_CASE_P(WebRtcSessionTests, | 4349 INSTANTIATE_TEST_CASE_P(WebRtcSessionTests, |
4330 WebRtcSessionTest, | 4350 WebRtcSessionTest, |
4331 testing::Values(ALREADY_GENERATED, | 4351 testing::Values(ALREADY_GENERATED, |
4332 DTLS_IDENTITY_STORE)); | 4352 DTLS_IDENTITY_STORE)); |
OLD | NEW |