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