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 if (session_->data_channel_type() != cricket::DCT_RTP) { |
579 session_options->data_channel_type = cricket::DCT_SCTP; | 581 session_options->data_channel_type = session_->data_channel_type(); |
580 } | 582 } |
581 | 583 |
582 if (with_gcm_) { | 584 if (with_gcm_) { |
583 session_options->crypto_options.enable_gcm_crypto_suites = true; | 585 session_options->crypto_options.enable_gcm_crypto_suites = true; |
584 } | 586 } |
585 } | 587 } |
586 | 588 |
587 // Creates a local offer and applies it. Starts ICE. | 589 // Creates a local offer and applies it. Starts ICE. |
588 // Call SendAudioVideoStreamX() before this function | 590 // Call SendAudioVideoStreamX() before this function |
589 // to decide which streams to create. | 591 // to decide which streams to create. |
(...skipping 3615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4205 candidate1.set_address(rtc::SocketAddress("1.1.1.1", 5000)); | 4207 candidate1.set_address(rtc::SocketAddress("1.1.1.1", 5000)); |
4206 candidate1.set_component(1); | 4208 candidate1.set_component(1); |
4207 JsepIceCandidate ice_candidate(kMediaContentName1, kMediaContentIndex1, | 4209 JsepIceCandidate ice_candidate(kMediaContentName1, kMediaContentIndex1, |
4208 candidate1); | 4210 candidate1); |
4209 EXPECT_TRUE(session_->ProcessIceMessage(&ice_candidate)); | 4211 EXPECT_TRUE(session_->ProcessIceMessage(&ice_candidate)); |
4210 | 4212 |
4211 answer = CreateAnswer(); | 4213 answer = CreateAnswer(); |
4212 SetLocalDescriptionWithoutError(answer); | 4214 SetLocalDescriptionWithoutError(answer); |
4213 } | 4215 } |
4214 | 4216 |
| 4217 #ifdef HAVE_QUIC |
| 4218 TEST_P(WebRtcSessionTest, TestNegotiateQuic) { |
| 4219 configuration_.enable_quic = true; |
| 4220 InitWithDtls(GetParam()); |
| 4221 EXPECT_TRUE(session_->data_channel_type() == cricket::DCT_QUIC); |
| 4222 SessionDescriptionInterface* offer = CreateOffer(); |
| 4223 ASSERT_TRUE(offer); |
| 4224 ASSERT_TRUE(offer->description()); |
| 4225 SetLocalDescriptionWithoutError(offer); |
| 4226 cricket::MediaSessionOptions options; |
| 4227 options.recv_audio = true; |
| 4228 options.recv_video = true; |
| 4229 SessionDescriptionInterface* answer = |
| 4230 CreateRemoteAnswer(offer, options, cricket::SEC_DISABLED); |
| 4231 ASSERT_TRUE(answer); |
| 4232 ASSERT_TRUE(answer->description()); |
| 4233 SetRemoteDescriptionWithoutError(answer); |
| 4234 } |
| 4235 #endif // HAVE_QUIC |
| 4236 |
4215 // Tests that RTX codec is removed from the answer when it isn't supported | 4237 // Tests that RTX codec is removed from the answer when it isn't supported |
4216 // by local side. | 4238 // by local side. |
4217 TEST_F(WebRtcSessionTest, TestRtxRemovedByCreateAnswer) { | 4239 TEST_F(WebRtcSessionTest, TestRtxRemovedByCreateAnswer) { |
4218 Init(); | 4240 Init(); |
4219 SendAudioVideoStream1(); | 4241 SendAudioVideoStream1(); |
4220 std::string offer_sdp(kSdpWithRtx); | 4242 std::string offer_sdp(kSdpWithRtx); |
4221 | 4243 |
4222 SessionDescriptionInterface* offer = | 4244 SessionDescriptionInterface* offer = |
4223 CreateSessionDescription(JsepSessionDescription::kOffer, offer_sdp, NULL); | 4245 CreateSessionDescription(JsepSessionDescription::kOffer, offer_sdp, NULL); |
4224 EXPECT_TRUE(offer->ToString(&offer_sdp)); | 4246 EXPECT_TRUE(offer->ToString(&offer_sdp)); |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4323 } | 4345 } |
4324 | 4346 |
4325 // TODO(bemasc): Add a TestIceStatesBundle with BUNDLE enabled. That test | 4347 // TODO(bemasc): Add a TestIceStatesBundle with BUNDLE enabled. That test |
4326 // currently fails because upon disconnection and reconnection OnIceComplete is | 4348 // currently fails because upon disconnection and reconnection OnIceComplete is |
4327 // called more than once without returning to IceGatheringGathering. | 4349 // called more than once without returning to IceGatheringGathering. |
4328 | 4350 |
4329 INSTANTIATE_TEST_CASE_P(WebRtcSessionTests, | 4351 INSTANTIATE_TEST_CASE_P(WebRtcSessionTests, |
4330 WebRtcSessionTest, | 4352 WebRtcSessionTest, |
4331 testing::Values(ALREADY_GENERATED, | 4353 testing::Values(ALREADY_GENERATED, |
4332 DTLS_IDENTITY_STORE)); | 4354 DTLS_IDENTITY_STORE)); |
OLD | NEW |