| 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 1095 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1106 InitWithDtmfCodec(); | 1106 InitWithDtmfCodec(); |
| 1107 } else { | 1107 } else { |
| 1108 Init(); | 1108 Init(); |
| 1109 } | 1109 } |
| 1110 SendAudioVideoStream1(); | 1110 SendAudioVideoStream1(); |
| 1111 CreateAndSetRemoteOfferAndLocalAnswer(); | 1111 CreateAndSetRemoteOfferAndLocalAnswer(); |
| 1112 EXPECT_FALSE(session_->CanInsertDtmf("")); | 1112 EXPECT_FALSE(session_->CanInsertDtmf("")); |
| 1113 EXPECT_EQ(can, session_->CanInsertDtmf(kAudioTrack1)); | 1113 EXPECT_EQ(can, session_->CanInsertDtmf(kAudioTrack1)); |
| 1114 } | 1114 } |
| 1115 | 1115 |
| 1116 bool ContainsVideoCodecWithName(const SessionDescriptionInterface* desc, |
| 1117 const std::string& codec_name) { |
| 1118 for (const auto& content : desc->description()->contents()) { |
| 1119 if (static_cast<cricket::MediaContentDescription*>(content.description) |
| 1120 ->type() == cricket::MEDIA_TYPE_VIDEO) { |
| 1121 const auto* mdesc = |
| 1122 static_cast<cricket::VideoContentDescription*>(content.description); |
| 1123 for (const auto& codec : mdesc->codecs()) { |
| 1124 if (codec.name == codec_name) { |
| 1125 return true; |
| 1126 } |
| 1127 } |
| 1128 } |
| 1129 } |
| 1130 return false; |
| 1131 } |
| 1116 // Helper class to configure loopback network and verify Best | 1132 // Helper class to configure loopback network and verify Best |
| 1117 // Connection using right IP protocol for TestLoopbackCall | 1133 // Connection using right IP protocol for TestLoopbackCall |
| 1118 // method. LoopbackNetworkManager applies firewall rules to block | 1134 // method. LoopbackNetworkManager applies firewall rules to block |
| 1119 // all ping traffic once ICE completed, and remove them to observe | 1135 // all ping traffic once ICE completed, and remove them to observe |
| 1120 // ICE reconnected again. This LoopbackNetworkConfiguration struct | 1136 // ICE reconnected again. This LoopbackNetworkConfiguration struct |
| 1121 // verifies the best connection is using the right IP protocol after | 1137 // verifies the best connection is using the right IP protocol after |
| 1122 // initial ICE convergences. | 1138 // initial ICE convergences. |
| 1123 | 1139 |
| 1124 class LoopbackNetworkConfiguration { | 1140 class LoopbackNetworkConfiguration { |
| 1125 public: | 1141 public: |
| (...skipping 3144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4270 candidate1.set_address(rtc::SocketAddress("1.1.1.1", 5000)); | 4286 candidate1.set_address(rtc::SocketAddress("1.1.1.1", 5000)); |
| 4271 candidate1.set_component(1); | 4287 candidate1.set_component(1); |
| 4272 JsepIceCandidate ice_candidate(kMediaContentName1, kMediaContentIndex1, | 4288 JsepIceCandidate ice_candidate(kMediaContentName1, kMediaContentIndex1, |
| 4273 candidate1); | 4289 candidate1); |
| 4274 EXPECT_TRUE(session_->ProcessIceMessage(&ice_candidate)); | 4290 EXPECT_TRUE(session_->ProcessIceMessage(&ice_candidate)); |
| 4275 | 4291 |
| 4276 answer = CreateAnswer(); | 4292 answer = CreateAnswer(); |
| 4277 SetLocalDescriptionWithoutError(answer); | 4293 SetLocalDescriptionWithoutError(answer); |
| 4278 } | 4294 } |
| 4279 | 4295 |
| 4280 // Flaky on Win and Mac only. See webrtc:4943 | |
| 4281 #if defined(WEBRTC_WIN) || defined(WEBRTC_MAC) | |
| 4282 #define MAYBE_TestRtxRemovedByCreateAnswer DISABLED_TestRtxRemovedByCreateAnswer | |
| 4283 #else | |
| 4284 #define MAYBE_TestRtxRemovedByCreateAnswer TestRtxRemovedByCreateAnswer | |
| 4285 #endif | |
| 4286 // Tests that RTX codec is removed from the answer when it isn't supported | 4296 // Tests that RTX codec is removed from the answer when it isn't supported |
| 4287 // by local side. | 4297 // by local side. |
| 4288 TEST_F(WebRtcSessionTest, MAYBE_TestRtxRemovedByCreateAnswer) { | 4298 TEST_F(WebRtcSessionTest, TestRtxRemovedByCreateAnswer) { |
| 4289 Init(); | 4299 Init(); |
| 4290 SendAudioVideoStream1(); | 4300 SendAudioVideoStream1(); |
| 4291 std::string offer_sdp(kSdpWithRtx); | 4301 std::string offer_sdp(kSdpWithRtx); |
| 4292 | 4302 |
| 4293 SessionDescriptionInterface* offer = | 4303 SessionDescriptionInterface* offer = |
| 4294 CreateSessionDescription(JsepSessionDescription::kOffer, offer_sdp, NULL); | 4304 CreateSessionDescription(JsepSessionDescription::kOffer, offer_sdp, NULL); |
| 4295 EXPECT_TRUE(offer->ToString(&offer_sdp)); | 4305 EXPECT_TRUE(offer->ToString(&offer_sdp)); |
| 4296 | 4306 |
| 4297 // Offer SDP contains the RTX codec. | 4307 // Offer SDP contains the RTX codec. |
| 4298 EXPECT_TRUE(offer_sdp.find("rtx") != std::string::npos); | 4308 EXPECT_TRUE(ContainsVideoCodecWithName(offer, "rtx")); |
| 4299 SetRemoteDescriptionWithoutError(offer); | 4309 SetRemoteDescriptionWithoutError(offer); |
| 4300 | 4310 |
| 4301 SessionDescriptionInterface* answer = CreateAnswer(); | 4311 SessionDescriptionInterface* answer = CreateAnswer(); |
| 4302 std::string answer_sdp; | 4312 // Answer SDP does not contain the RTX codec. |
| 4303 answer->ToString(&answer_sdp); | 4313 EXPECT_FALSE(ContainsVideoCodecWithName(answer, "rtx")); |
| 4304 // Answer SDP removes the unsupported RTX codec. | |
| 4305 EXPECT_TRUE(answer_sdp.find("rtx") == std::string::npos); | |
| 4306 SetLocalDescriptionWithoutError(answer); | 4314 SetLocalDescriptionWithoutError(answer); |
| 4307 } | 4315 } |
| 4308 | 4316 |
| 4309 // This verifies that the voice channel after bundle has both options from video | 4317 // This verifies that the voice channel after bundle has both options from video |
| 4310 // and voice channels. | 4318 // and voice channels. |
| 4311 TEST_F(WebRtcSessionTest, TestSetSocketOptionBeforeBundle) { | 4319 TEST_F(WebRtcSessionTest, TestSetSocketOptionBeforeBundle) { |
| 4312 InitWithBundlePolicy(PeerConnectionInterface::kBundlePolicyBalanced); | 4320 InitWithBundlePolicy(PeerConnectionInterface::kBundlePolicyBalanced); |
| 4313 SendAudioVideoStream1(); | 4321 SendAudioVideoStream1(); |
| 4314 | 4322 |
| 4315 PeerConnectionInterface::RTCOfferAnswerOptions options; | 4323 PeerConnectionInterface::RTCOfferAnswerOptions options; |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4396 } | 4404 } |
| 4397 | 4405 |
| 4398 // TODO(bemasc): Add a TestIceStatesBundle with BUNDLE enabled. That test | 4406 // TODO(bemasc): Add a TestIceStatesBundle with BUNDLE enabled. That test |
| 4399 // currently fails because upon disconnection and reconnection OnIceComplete is | 4407 // currently fails because upon disconnection and reconnection OnIceComplete is |
| 4400 // called more than once without returning to IceGatheringGathering. | 4408 // called more than once without returning to IceGatheringGathering. |
| 4401 | 4409 |
| 4402 INSTANTIATE_TEST_CASE_P(WebRtcSessionTests, | 4410 INSTANTIATE_TEST_CASE_P(WebRtcSessionTests, |
| 4403 WebRtcSessionTest, | 4411 WebRtcSessionTest, |
| 4404 testing::Values(ALREADY_GENERATED, | 4412 testing::Values(ALREADY_GENERATED, |
| 4405 DTLS_IDENTITY_STORE)); | 4413 DTLS_IDENTITY_STORE)); |
| OLD | NEW |