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

Side by Side Diff: webrtc/media/engine/webrtcvideoengine2_unittest.cc

Issue 2621573002: Remove FlexfecConfig and replace with specific struct in VideoSendStream. (Closed)
Patch Set: Created 3 years, 11 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
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2004 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2004 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 2329 matching lines...) Expand 10 before | Expand all | Expand 10 after
2340 EXPECT_EQ(kRtxSsrcs1[0], config.rtp.rtx.ssrcs[0]); 2340 EXPECT_EQ(kRtxSsrcs1[0], config.rtp.rtx.ssrcs[0]);
2341 VerifySendStreamHasRtxTypes(config, default_apt_rtx_types_); 2341 VerifySendStreamHasRtxTypes(config, default_apt_rtx_types_);
2342 // TODO(juberti): Check RTCP, PLI, TMMBR. 2342 // TODO(juberti): Check RTCP, PLI, TMMBR.
2343 } 2343 }
2344 2344
2345 // TODO(brandtr): Remove when FlexFEC _is_ exposed by default. 2345 // TODO(brandtr): Remove when FlexFEC _is_ exposed by default.
2346 TEST_F(WebRtcVideoChannel2Test, FlexfecCodecWithoutSsrcNotExposedByDefault) { 2346 TEST_F(WebRtcVideoChannel2Test, FlexfecCodecWithoutSsrcNotExposedByDefault) {
2347 FakeVideoSendStream* stream = AddSendStream(); 2347 FakeVideoSendStream* stream = AddSendStream();
2348 webrtc::VideoSendStream::Config config = stream->GetConfig().Copy(); 2348 webrtc::VideoSendStream::Config config = stream->GetConfig().Copy();
2349 2349
2350 EXPECT_EQ(-1, config.rtp.flexfec.flexfec_payload_type); 2350 EXPECT_EQ(-1, config.rtp.flexfec.payload_type);
2351 } 2351 }
2352 2352
2353 // TODO(brandtr): Remove when FlexFEC _is_ exposed by default. 2353 // TODO(brandtr): Remove when FlexFEC _is_ exposed by default.
2354 TEST_F(WebRtcVideoChannel2Test, FlexfecCodecWithSsrcNotExposedByDefault) { 2354 TEST_F(WebRtcVideoChannel2Test, FlexfecCodecWithSsrcNotExposedByDefault) {
2355 FakeVideoSendStream* stream = AddSendStream( 2355 FakeVideoSendStream* stream = AddSendStream(
2356 CreatePrimaryWithFecFrStreamParams("cname", kSsrcs1[0], kFlexfecSsrc)); 2356 CreatePrimaryWithFecFrStreamParams("cname", kSsrcs1[0], kFlexfecSsrc));
2357 webrtc::VideoSendStream::Config config = stream->GetConfig().Copy(); 2357 webrtc::VideoSendStream::Config config = stream->GetConfig().Copy();
2358 2358
2359 EXPECT_EQ(-1, config.rtp.flexfec.flexfec_payload_type); 2359 EXPECT_EQ(-1, config.rtp.flexfec.payload_type);
2360 } 2360 }
2361 2361
2362 // TODO(brandtr): When FlexFEC is no longer behind a field trial, merge all 2362 // TODO(brandtr): When FlexFEC is no longer behind a field trial, merge all
2363 // tests that use this test fixture into the corresponding "non-field trial" 2363 // tests that use this test fixture into the corresponding "non-field trial"
2364 // tests. 2364 // tests.
2365 class WebRtcVideoChannel2FlexfecTest : public WebRtcVideoChannel2Test { 2365 class WebRtcVideoChannel2FlexfecTest : public WebRtcVideoChannel2Test {
2366 public: 2366 public:
2367 WebRtcVideoChannel2FlexfecTest() 2367 WebRtcVideoChannel2FlexfecTest()
2368 : WebRtcVideoChannel2Test("WebRTC-FlexFEC-03/Enabled/") {} 2368 : WebRtcVideoChannel2Test("WebRTC-FlexFEC-03/Enabled/") {}
2369 }; 2369 };
2370 2370
2371 // TODO(brandtr): Merge into "non-field trial" test when FlexFEC is enabled 2371 // TODO(brandtr): Merge into "non-field trial" test when FlexFEC is enabled
2372 // by default. 2372 // by default.
2373 TEST_F(WebRtcVideoChannel2FlexfecTest, SetDefaultSendCodecsWithoutSsrc) { 2373 TEST_F(WebRtcVideoChannel2FlexfecTest, SetDefaultSendCodecsWithoutSsrc) {
2374 FakeVideoSendStream* stream = AddSendStream(); 2374 FakeVideoSendStream* stream = AddSendStream();
2375 webrtc::VideoSendStream::Config config = stream->GetConfig().Copy(); 2375 webrtc::VideoSendStream::Config config = stream->GetConfig().Copy();
2376 2376
2377 EXPECT_EQ(GetEngineCodec("flexfec-03").id, 2377 EXPECT_EQ(GetEngineCodec("flexfec-03").id, config.rtp.flexfec.payload_type);
2378 config.rtp.flexfec.flexfec_payload_type); 2378 EXPECT_EQ(0U, config.rtp.flexfec.ssrc);
2379 EXPECT_FALSE(config.rtp.flexfec.IsCompleteAndEnabled()); 2379 EXPECT_TRUE(config.rtp.flexfec.protected_media_ssrcs.empty());
2380 } 2380 }
2381 2381
2382 // TODO(brandtr): Merge into "non-field trial" test when FlexFEC is enabled 2382 // TODO(brandtr): Merge into "non-field trial" test when FlexFEC is enabled
2383 // by default. 2383 // by default.
2384 TEST_F(WebRtcVideoChannel2FlexfecTest, SetDefaultSendCodecsWithSsrc) { 2384 TEST_F(WebRtcVideoChannel2FlexfecTest, SetDefaultSendCodecsWithSsrc) {
2385 FakeVideoSendStream* stream = AddSendStream( 2385 FakeVideoSendStream* stream = AddSendStream(
2386 CreatePrimaryWithFecFrStreamParams("cname", kSsrcs1[0], kFlexfecSsrc)); 2386 CreatePrimaryWithFecFrStreamParams("cname", kSsrcs1[0], kFlexfecSsrc));
2387 webrtc::VideoSendStream::Config config = stream->GetConfig().Copy(); 2387 webrtc::VideoSendStream::Config config = stream->GetConfig().Copy();
2388 2388
2389 EXPECT_EQ(GetEngineCodec("flexfec-03").id, 2389 EXPECT_EQ(GetEngineCodec("flexfec-03").id, config.rtp.flexfec.payload_type);
2390 config.rtp.flexfec.flexfec_payload_type); 2390 EXPECT_EQ(kFlexfecSsrc, config.rtp.flexfec.ssrc);
2391 EXPECT_TRUE(config.rtp.flexfec.IsCompleteAndEnabled()); 2391 ASSERT_EQ(1U, config.rtp.flexfec.protected_media_ssrcs.size());
2392 EXPECT_EQ(kSsrcs1[0], config.rtp.flexfec.protected_media_ssrcs[0]);
2392 } 2393 }
2393 2394
2394 TEST_F(WebRtcVideoChannel2Test, SetSendCodecsWithoutFec) { 2395 TEST_F(WebRtcVideoChannel2Test, SetSendCodecsWithoutFec) {
2395 cricket::VideoSendParameters parameters; 2396 cricket::VideoSendParameters parameters;
2396 parameters.codecs.push_back(GetEngineCodec("VP8")); 2397 parameters.codecs.push_back(GetEngineCodec("VP8"));
2397 ASSERT_TRUE(channel_->SetSendParameters(parameters)); 2398 ASSERT_TRUE(channel_->SetSendParameters(parameters));
2398 2399
2399 FakeVideoSendStream* stream = AddSendStream(); 2400 FakeVideoSendStream* stream = AddSendStream();
2400 webrtc::VideoSendStream::Config config = stream->GetConfig().Copy(); 2401 webrtc::VideoSendStream::Config config = stream->GetConfig().Copy();
2401 2402
2402 EXPECT_EQ(-1, config.rtp.ulpfec.ulpfec_payload_type); 2403 EXPECT_EQ(-1, config.rtp.ulpfec.ulpfec_payload_type);
2403 EXPECT_EQ(-1, config.rtp.ulpfec.red_payload_type); 2404 EXPECT_EQ(-1, config.rtp.ulpfec.red_payload_type);
2404 } 2405 }
2405 2406
2406 // TODO(brandtr): Merge into "non-field trial" test when FlexFEC is enabled 2407 // TODO(brandtr): Merge into "non-field trial" test when FlexFEC is enabled
2407 // by default. 2408 // by default.
2408 TEST_F(WebRtcVideoChannel2FlexfecTest, SetSendCodecsWithoutFec) { 2409 TEST_F(WebRtcVideoChannel2FlexfecTest, SetSendCodecsWithoutFec) {
2409 cricket::VideoSendParameters parameters; 2410 cricket::VideoSendParameters parameters;
2410 parameters.codecs.push_back(GetEngineCodec("VP8")); 2411 parameters.codecs.push_back(GetEngineCodec("VP8"));
2411 ASSERT_TRUE(channel_->SetSendParameters(parameters)); 2412 ASSERT_TRUE(channel_->SetSendParameters(parameters));
2412 2413
2413 FakeVideoSendStream* stream = AddSendStream(); 2414 FakeVideoSendStream* stream = AddSendStream();
2414 webrtc::VideoSendStream::Config config = stream->GetConfig().Copy(); 2415 webrtc::VideoSendStream::Config config = stream->GetConfig().Copy();
2415 2416
2416 EXPECT_EQ(-1, config.rtp.flexfec.flexfec_payload_type); 2417 EXPECT_EQ(-1, config.rtp.flexfec.payload_type);
2417 } 2418 }
2418 2419
2419 TEST_F(WebRtcVideoChannel2Test, 2420 TEST_F(WebRtcVideoChannel2Test,
2420 SetSendCodecRejectsRtxWithoutAssociatedPayloadType) { 2421 SetSendCodecRejectsRtxWithoutAssociatedPayloadType) {
2421 const int kUnusedPayloadType = 127; 2422 const int kUnusedPayloadType = 127;
2422 EXPECT_FALSE(FindCodecById(engine_.codecs(), kUnusedPayloadType)); 2423 EXPECT_FALSE(FindCodecById(engine_.codecs(), kUnusedPayloadType));
2423 2424
2424 cricket::VideoSendParameters parameters; 2425 cricket::VideoSendParameters parameters;
2425 cricket::VideoCodec rtx_codec(kUnusedPayloadType, "rtx"); 2426 cricket::VideoCodec rtx_codec(kUnusedPayloadType, "rtx");
2426 parameters.codecs.push_back(rtx_codec); 2427 parameters.codecs.push_back(rtx_codec);
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
2478 TEST_F(WebRtcVideoChannel2FlexfecTest, SetSendCodecsWithoutFecDisablesFec) { 2479 TEST_F(WebRtcVideoChannel2FlexfecTest, SetSendCodecsWithoutFecDisablesFec) {
2479 cricket::VideoSendParameters parameters; 2480 cricket::VideoSendParameters parameters;
2480 parameters.codecs.push_back(GetEngineCodec("VP8")); 2481 parameters.codecs.push_back(GetEngineCodec("VP8"));
2481 parameters.codecs.push_back(GetEngineCodec("flexfec-03")); 2482 parameters.codecs.push_back(GetEngineCodec("flexfec-03"));
2482 ASSERT_TRUE(channel_->SetSendParameters(parameters)); 2483 ASSERT_TRUE(channel_->SetSendParameters(parameters));
2483 2484
2484 FakeVideoSendStream* stream = AddSendStream( 2485 FakeVideoSendStream* stream = AddSendStream(
2485 CreatePrimaryWithFecFrStreamParams("cname", kSsrcs1[0], kFlexfecSsrc)); 2486 CreatePrimaryWithFecFrStreamParams("cname", kSsrcs1[0], kFlexfecSsrc));
2486 webrtc::VideoSendStream::Config config = stream->GetConfig().Copy(); 2487 webrtc::VideoSendStream::Config config = stream->GetConfig().Copy();
2487 2488
2488 EXPECT_EQ(GetEngineCodec("flexfec-03").id, 2489 EXPECT_EQ(GetEngineCodec("flexfec-03").id, config.rtp.flexfec.payload_type);
2489 config.rtp.flexfec.flexfec_payload_type); 2490 EXPECT_EQ(kFlexfecSsrc, config.rtp.flexfec.ssrc);
2490 EXPECT_EQ(kFlexfecSsrc, config.rtp.flexfec.flexfec_ssrc);
2491 ASSERT_EQ(1U, config.rtp.flexfec.protected_media_ssrcs.size()); 2491 ASSERT_EQ(1U, config.rtp.flexfec.protected_media_ssrcs.size());
2492 EXPECT_EQ(kSsrcs1[0], config.rtp.flexfec.protected_media_ssrcs[0]); 2492 EXPECT_EQ(kSsrcs1[0], config.rtp.flexfec.protected_media_ssrcs[0]);
2493 2493
2494 parameters.codecs.pop_back(); 2494 parameters.codecs.pop_back();
2495 ASSERT_TRUE(channel_->SetSendParameters(parameters)); 2495 ASSERT_TRUE(channel_->SetSendParameters(parameters));
2496 stream = fake_call_->GetVideoSendStreams()[0]; 2496 stream = fake_call_->GetVideoSendStreams()[0];
2497 ASSERT_TRUE(stream != nullptr); 2497 ASSERT_TRUE(stream != nullptr);
2498 config = stream->GetConfig().Copy(); 2498 config = stream->GetConfig().Copy();
2499 EXPECT_EQ(-1, config.rtp.flexfec.flexfec_payload_type) 2499 EXPECT_EQ(-1, config.rtp.flexfec.payload_type)
2500 << "SetSendCodec without FlexFEC should disable current FlexFEC."; 2500 << "SetSendCodec without FlexFEC should disable current FlexFEC.";
2501 } 2501 }
2502 2502
2503 TEST_F(WebRtcVideoChannel2Test, SetSendCodecsChangesExistingStreams) { 2503 TEST_F(WebRtcVideoChannel2Test, SetSendCodecsChangesExistingStreams) {
2504 cricket::VideoSendParameters parameters; 2504 cricket::VideoSendParameters parameters;
2505 cricket::VideoCodec codec(100, "VP8"); 2505 cricket::VideoCodec codec(100, "VP8");
2506 codec.SetParam(kCodecParamMaxQuantization, kDefaultQpMax); 2506 codec.SetParam(kCodecParamMaxQuantization, kDefaultQpMax);
2507 parameters.codecs.push_back(codec); 2507 parameters.codecs.push_back(codec);
2508 2508
2509 ASSERT_TRUE(channel_->SetSendParameters(parameters)); 2509 ASSERT_TRUE(channel_->SetSendParameters(parameters));
(...skipping 1548 matching lines...) Expand 10 before | Expand all | Expand 10 after
4058 4058
4059 TEST_F(WebRtcVideoChannel2SimulcastTest, SetSendCodecsWith3SimulcastStreams) { 4059 TEST_F(WebRtcVideoChannel2SimulcastTest, SetSendCodecsWith3SimulcastStreams) {
4060 VerifySimulcastSettings(cricket::VideoCodec("VP8"), 1280, 720, 3, 3); 4060 VerifySimulcastSettings(cricket::VideoCodec("VP8"), 1280, 720, 3, 3);
4061 } 4061 }
4062 4062
4063 // Test that we normalize send codec format size in simulcast. 4063 // Test that we normalize send codec format size in simulcast.
4064 TEST_F(WebRtcVideoChannel2SimulcastTest, SetSendCodecsWithOddSizeInSimulcast) { 4064 TEST_F(WebRtcVideoChannel2SimulcastTest, SetSendCodecsWithOddSizeInSimulcast) {
4065 VerifySimulcastSettings(cricket::VideoCodec("VP8"), 541, 271, 2, 2); 4065 VerifySimulcastSettings(cricket::VideoCodec("VP8"), 541, 271, 2, 2);
4066 } 4066 }
4067 } // namespace cricket 4067 } // namespace cricket
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698