Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(152)

Side by Side Diff: webrtc/api/webrtcsession_unittest.cc

Issue 1919523002: Fix the flaky WebRtcSessionTest.TestRtxRemovedByCreateAnswer. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Create helper function to determine if the SessionDescriptionContains rtx codec. Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 DescriptionContainsRtxCodec(const SessionDescriptionInterface* desc) {
1117 for (const auto& content : desc->description()->contents()) {
1118 if (static_cast<cricket::MediaContentDescription*>(content.description)
1119 ->type() == cricket::MEDIA_TYPE_VIDEO) {
1120 const auto* mdesc =
1121 static_cast<cricket::VideoContentDescription*>(content.description);
1122 for (const auto& codec : mdesc->codecs()) {
1123 if (codec.name == "rtx") {
1124 return true;
1125 }
1126 }
1127 }
1128 }
1129 return false;
1130 }
1116 // Helper class to configure loopback network and verify Best 1131 // Helper class to configure loopback network and verify Best
1117 // Connection using right IP protocol for TestLoopbackCall 1132 // Connection using right IP protocol for TestLoopbackCall
1118 // method. LoopbackNetworkManager applies firewall rules to block 1133 // method. LoopbackNetworkManager applies firewall rules to block
1119 // all ping traffic once ICE completed, and remove them to observe 1134 // all ping traffic once ICE completed, and remove them to observe
1120 // ICE reconnected again. This LoopbackNetworkConfiguration struct 1135 // ICE reconnected again. This LoopbackNetworkConfiguration struct
1121 // verifies the best connection is using the right IP protocol after 1136 // verifies the best connection is using the right IP protocol after
1122 // initial ICE convergences. 1137 // initial ICE convergences.
1123 1138
1124 class LoopbackNetworkConfiguration { 1139 class LoopbackNetworkConfiguration {
1125 public: 1140 public:
(...skipping 3151 matching lines...) Expand 10 before | Expand all | Expand 10 after
4277 candidate1.set_address(rtc::SocketAddress("1.1.1.1", 5000)); 4292 candidate1.set_address(rtc::SocketAddress("1.1.1.1", 5000));
4278 candidate1.set_component(1); 4293 candidate1.set_component(1);
4279 JsepIceCandidate ice_candidate(kMediaContentName1, kMediaContentIndex1, 4294 JsepIceCandidate ice_candidate(kMediaContentName1, kMediaContentIndex1,
4280 candidate1); 4295 candidate1);
4281 EXPECT_TRUE(session_->ProcessIceMessage(&ice_candidate)); 4296 EXPECT_TRUE(session_->ProcessIceMessage(&ice_candidate));
4282 4297
4283 answer = CreateAnswer(); 4298 answer = CreateAnswer();
4284 SetLocalDescriptionWithoutError(answer); 4299 SetLocalDescriptionWithoutError(answer);
4285 } 4300 }
4286 4301
4287 // Flaky on Win and Mac only. See webrtc:4943
4288 #if defined(WEBRTC_WIN) || defined(WEBRTC_MAC)
4289 #define MAYBE_TestRtxRemovedByCreateAnswer DISABLED_TestRtxRemovedByCreateAnswer
4290 #else
4291 #define MAYBE_TestRtxRemovedByCreateAnswer TestRtxRemovedByCreateAnswer
4292 #endif
4293 // Tests that RTX codec is removed from the answer when it isn't supported 4302 // Tests that RTX codec is removed from the answer when it isn't supported
4294 // by local side. 4303 // by local side.
4295 TEST_F(WebRtcSessionTest, MAYBE_TestRtxRemovedByCreateAnswer) { 4304 TEST_F(WebRtcSessionTest, TestRtxRemovedByCreateAnswer) {
4296 Init(); 4305 Init();
4297 SendAudioVideoStream1(); 4306 SendAudioVideoStream1();
4298 std::string offer_sdp(kSdpWithRtx); 4307 std::string offer_sdp(kSdpWithRtx);
4299 4308
4300 SessionDescriptionInterface* offer = 4309 SessionDescriptionInterface* offer =
4301 CreateSessionDescription(JsepSessionDescription::kOffer, offer_sdp, NULL); 4310 CreateSessionDescription(JsepSessionDescription::kOffer, offer_sdp, NULL);
4302 EXPECT_TRUE(offer->ToString(&offer_sdp)); 4311 EXPECT_TRUE(offer->ToString(&offer_sdp));
4303 4312
4304 // Offer SDP contains the RTX codec. 4313 // Offer SDP contains the RTX codec.
4305 EXPECT_TRUE(offer_sdp.find("rtx") != std::string::npos); 4314 EXPECT_TRUE(DescriptionContainsRtxCodec(offer));
4306 SetRemoteDescriptionWithoutError(offer); 4315 SetRemoteDescriptionWithoutError(offer);
4307 4316
4308 SessionDescriptionInterface* answer = CreateAnswer(); 4317 SessionDescriptionInterface* answer = CreateAnswer();
4309 std::string answer_sdp;
4310 answer->ToString(&answer_sdp);
4311 // Answer SDP removes the unsupported RTX codec.
4312 EXPECT_TRUE(answer_sdp.find("rtx") == std::string::npos);
4313 SetLocalDescriptionWithoutError(answer); 4318 SetLocalDescriptionWithoutError(answer);
4319 // Answer SDP does not contain the RTX codec.
4320 EXPECT_FALSE(DescriptionContainsRtxCodec(answer));
Taylor Brandstetter 2016/04/23 01:25:40 nit: Can you move this back to before "SetLocalDes
4314 } 4321 }
4315 4322
4316 // This verifies that the voice channel after bundle has both options from video 4323 // This verifies that the voice channel after bundle has both options from video
4317 // and voice channels. 4324 // and voice channels.
4318 TEST_F(WebRtcSessionTest, TestSetSocketOptionBeforeBundle) { 4325 TEST_F(WebRtcSessionTest, TestSetSocketOptionBeforeBundle) {
4319 InitWithBundlePolicy(PeerConnectionInterface::kBundlePolicyBalanced); 4326 InitWithBundlePolicy(PeerConnectionInterface::kBundlePolicyBalanced);
4320 SendAudioVideoStream1(); 4327 SendAudioVideoStream1();
4321 4328
4322 PeerConnectionInterface::RTCOfferAnswerOptions options; 4329 PeerConnectionInterface::RTCOfferAnswerOptions options;
4323 options.use_rtp_mux = true; 4330 options.use_rtp_mux = true;
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
4403 } 4410 }
4404 4411
4405 // TODO(bemasc): Add a TestIceStatesBundle with BUNDLE enabled. That test 4412 // TODO(bemasc): Add a TestIceStatesBundle with BUNDLE enabled. That test
4406 // currently fails because upon disconnection and reconnection OnIceComplete is 4413 // currently fails because upon disconnection and reconnection OnIceComplete is
4407 // called more than once without returning to IceGatheringGathering. 4414 // called more than once without returning to IceGatheringGathering.
4408 4415
4409 INSTANTIATE_TEST_CASE_P(WebRtcSessionTests, 4416 INSTANTIATE_TEST_CASE_P(WebRtcSessionTests,
4410 WebRtcSessionTest, 4417 WebRtcSessionTest,
4411 testing::Values(ALREADY_GENERATED, 4418 testing::Values(ALREADY_GENERATED,
4412 DTLS_IDENTITY_STORE)); 4419 DTLS_IDENTITY_STORE));
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698