| 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 525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 536 session_options->recv_video = | 536 session_options->recv_video = |
| 537 session_options->HasSendMediaStream(cricket::MEDIA_TYPE_VIDEO); | 537 session_options->HasSendMediaStream(cricket::MEDIA_TYPE_VIDEO); |
| 538 } | 538 } |
| 539 session_options->bundle_enabled = | 539 session_options->bundle_enabled = |
| 540 session_options->bundle_enabled && | 540 session_options->bundle_enabled && |
| 541 (session_options->has_audio() || session_options->has_video() || | 541 (session_options->has_audio() || session_options->has_video() || |
| 542 session_options->has_data()); | 542 session_options->has_data()); |
| 543 | 543 |
| 544 if (session_->data_channel_type() == cricket::DCT_SCTP && data_channel_) { | 544 if (session_->data_channel_type() == cricket::DCT_SCTP && data_channel_) { |
| 545 session_options->data_channel_type = cricket::DCT_SCTP; | 545 session_options->data_channel_type = cricket::DCT_SCTP; |
| 546 } else if (session_->data_channel_type() == cricket::DCT_QUIC) { |
| 547 session_options->data_channel_type = cricket::DCT_QUIC; |
| 546 } | 548 } |
| 547 } | 549 } |
| 548 | 550 |
| 549 void GetOptionsForAnswer(cricket::MediaSessionOptions* session_options) { | 551 void GetOptionsForAnswer(cricket::MediaSessionOptions* session_options) { |
| 550 // ParseConstraintsForAnswer is used to set some defaults. | 552 // ParseConstraintsForAnswer is used to set some defaults. |
| 551 ASSERT_TRUE(webrtc::ParseConstraintsForAnswer(nullptr, session_options)); | 553 ASSERT_TRUE(webrtc::ParseConstraintsForAnswer(nullptr, session_options)); |
| 552 | 554 |
| 553 AddStreamsToOptions(session_options); | 555 AddStreamsToOptions(session_options); |
| 554 session_options->bundle_enabled = | 556 session_options->bundle_enabled = |
| 555 session_options->bundle_enabled && | 557 session_options->bundle_enabled && |
| 556 (session_options->has_audio() || session_options->has_video() || | 558 (session_options->has_audio() || session_options->has_video() || |
| 557 session_options->has_data()); | 559 session_options->has_data()); |
| 558 | 560 |
| 559 if (session_->data_channel_type() == cricket::DCT_SCTP) { | 561 session_options->data_channel_type = session_->data_channel_type(); |
| 560 session_options->data_channel_type = cricket::DCT_SCTP; | |
| 561 } | |
| 562 } | 562 } |
| 563 | 563 |
| 564 // Creates a local offer and applies it. Starts ICE. | 564 // Creates a local offer and applies it. Starts ICE. |
| 565 // Call SendAudioVideoStreamX() before this function | 565 // Call SendAudioVideoStreamX() before this function |
| 566 // to decide which streams to create. | 566 // to decide which streams to create. |
| 567 void InitiateCall() { | 567 void InitiateCall() { |
| 568 SessionDescriptionInterface* offer = CreateOffer(); | 568 SessionDescriptionInterface* offer = CreateOffer(); |
| 569 SetLocalDescriptionWithoutError(offer); | 569 SetLocalDescriptionWithoutError(offer); |
| 570 EXPECT_TRUE_WAIT(PeerConnectionInterface::kIceGatheringNew != | 570 EXPECT_TRUE_WAIT(PeerConnectionInterface::kIceGatheringNew != |
| 571 observer_.ice_gathering_state_, | 571 observer_.ice_gathering_state_, |
| (...skipping 3568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4140 candidate1.set_address(rtc::SocketAddress("1.1.1.1", 5000)); | 4140 candidate1.set_address(rtc::SocketAddress("1.1.1.1", 5000)); |
| 4141 candidate1.set_component(1); | 4141 candidate1.set_component(1); |
| 4142 JsepIceCandidate ice_candidate(kMediaContentName1, kMediaContentIndex1, | 4142 JsepIceCandidate ice_candidate(kMediaContentName1, kMediaContentIndex1, |
| 4143 candidate1); | 4143 candidate1); |
| 4144 EXPECT_TRUE(session_->ProcessIceMessage(&ice_candidate)); | 4144 EXPECT_TRUE(session_->ProcessIceMessage(&ice_candidate)); |
| 4145 | 4145 |
| 4146 answer = CreateAnswer(); | 4146 answer = CreateAnswer(); |
| 4147 SetLocalDescriptionWithoutError(answer); | 4147 SetLocalDescriptionWithoutError(answer); |
| 4148 } | 4148 } |
| 4149 | 4149 |
| 4150 #ifdef HAVE_QUIC |
| 4151 TEST_P(WebRtcSessionTest, TestNegotiateQuic) { |
| 4152 configuration_.enable_quic = true; |
| 4153 InitWithDtls(GetParam()); |
| 4154 EXPECT_TRUE(session_->data_channel_type() == cricket::DCT_QUIC); |
| 4155 SessionDescriptionInterface* offer = CreateOffer(); |
| 4156 ASSERT_TRUE(offer); |
| 4157 ASSERT_TRUE(offer->description()); |
| 4158 SetLocalDescriptionWithoutError(offer); |
| 4159 cricket::MediaSessionOptions options; |
| 4160 options.recv_audio = true; |
| 4161 options.recv_video = true; |
| 4162 SessionDescriptionInterface* answer = |
| 4163 CreateRemoteAnswer(offer, options, cricket::SEC_DISABLED); |
| 4164 ASSERT_TRUE(answer); |
| 4165 ASSERT_TRUE(answer->description()); |
| 4166 SetRemoteDescriptionWithoutError(answer); |
| 4167 } |
| 4168 #endif // HAVE_QUIC |
| 4169 |
| 4150 // Tests that RTX codec is removed from the answer when it isn't supported | 4170 // Tests that RTX codec is removed from the answer when it isn't supported |
| 4151 // by local side. | 4171 // by local side. |
| 4152 TEST_F(WebRtcSessionTest, TestRtxRemovedByCreateAnswer) { | 4172 TEST_F(WebRtcSessionTest, TestRtxRemovedByCreateAnswer) { |
| 4153 Init(); | 4173 Init(); |
| 4154 SendAudioVideoStream1(); | 4174 SendAudioVideoStream1(); |
| 4155 std::string offer_sdp(kSdpWithRtx); | 4175 std::string offer_sdp(kSdpWithRtx); |
| 4156 | 4176 |
| 4157 SessionDescriptionInterface* offer = | 4177 SessionDescriptionInterface* offer = |
| 4158 CreateSessionDescription(JsepSessionDescription::kOffer, offer_sdp, NULL); | 4178 CreateSessionDescription(JsepSessionDescription::kOffer, offer_sdp, NULL); |
| 4159 EXPECT_TRUE(offer->ToString(&offer_sdp)); | 4179 EXPECT_TRUE(offer->ToString(&offer_sdp)); |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4258 } | 4278 } |
| 4259 | 4279 |
| 4260 // TODO(bemasc): Add a TestIceStatesBundle with BUNDLE enabled. That test | 4280 // TODO(bemasc): Add a TestIceStatesBundle with BUNDLE enabled. That test |
| 4261 // currently fails because upon disconnection and reconnection OnIceComplete is | 4281 // currently fails because upon disconnection and reconnection OnIceComplete is |
| 4262 // called more than once without returning to IceGatheringGathering. | 4282 // called more than once without returning to IceGatheringGathering. |
| 4263 | 4283 |
| 4264 INSTANTIATE_TEST_CASE_P(WebRtcSessionTests, | 4284 INSTANTIATE_TEST_CASE_P(WebRtcSessionTests, |
| 4265 WebRtcSessionTest, | 4285 WebRtcSessionTest, |
| 4266 testing::Values(ALREADY_GENERATED, | 4286 testing::Values(ALREADY_GENERATED, |
| 4267 DTLS_IDENTITY_STORE)); | 4287 DTLS_IDENTITY_STORE)); |
| OLD | NEW |