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

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

Issue 2334683002: Add method cricket::VideoCapturer::NeedsDenoising, use in VideoCapturerTrackSource. (Closed)
Patch Set: Add tests for needs_denoising. Created 4 years, 3 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 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 426 matching lines...) Expand 10 before | Expand all | Expand 10 after
437 ASSERT_TRUE(source_->is_screencast()); 437 ASSERT_TRUE(source_->is_screencast());
438 EXPECT_EQ_WAIT(MediaSourceInterface::kLive, state_observer_->state(), 438 EXPECT_EQ_WAIT(MediaSourceInterface::kLive, state_observer_->state(),
439 kMaxWaitMs); 439 kMaxWaitMs);
440 const cricket::VideoFormat* format = capturer_->GetCaptureFormat(); 440 const cricket::VideoFormat* format = capturer_->GetCaptureFormat();
441 ASSERT_TRUE(format != NULL); 441 ASSERT_TRUE(format != NULL);
442 EXPECT_EQ(480, format->width); 442 EXPECT_EQ(480, format->width);
443 EXPECT_EQ(270, format->height); 443 EXPECT_EQ(270, format->height);
444 EXPECT_EQ(30, format->framerate()); 444 EXPECT_EQ(30, format->framerate());
445 } 445 }
446 446
447 TEST_F(VideoCapturerTrackSourceTest, DenoisingDefault) {
448 CreateVideoCapturerSource();
449 EXPECT_FALSE(source_->needs_denoising());
450 }
451
452 TEST_F(VideoCapturerTrackSourceTest, DenoisingConstraintOn) {
pbos-webrtc 2016/09/13 14:02:09 I would like a test for constraints overriding the
nisse-webrtc 2016/09/13 14:24:05 Done.
453 FakeConstraints constraints;
454 constraints.AddOptional(MediaConstraintsInterface::kNoiseReduction, true);
455 CreateVideoCapturerSource(&constraints);
456 ASSERT_TRUE(source_->needs_denoising());
457 EXPECT_TRUE(*source_->needs_denoising());
458 }
459
460 TEST_F(VideoCapturerTrackSourceTest, DenoisingCapturerOff) {
461 capturer_->SetNeedsDenoising(false);
462 CreateVideoCapturerSource();
463 ASSERT_TRUE(source_->needs_denoising());
464 EXPECT_FALSE(*source_->needs_denoising());
465 }
466
447 TEST_F(VideoCapturerTrackSourceTest, MandatorySubOneFpsConstraints) { 467 TEST_F(VideoCapturerTrackSourceTest, MandatorySubOneFpsConstraints) {
448 FakeConstraints constraints; 468 FakeConstraints constraints;
449 constraints.AddMandatory(MediaConstraintsInterface::kMaxFrameRate, 0.5); 469 constraints.AddMandatory(MediaConstraintsInterface::kMaxFrameRate, 0.5);
450 470
451 CreateVideoCapturerSource(&constraints); 471 CreateVideoCapturerSource(&constraints);
452 EXPECT_EQ_WAIT(MediaSourceInterface::kEnded, state_observer_->state(), 472 EXPECT_EQ_WAIT(MediaSourceInterface::kEnded, state_observer_->state(),
453 kMaxWaitMs); 473 kMaxWaitMs);
454 ASSERT_TRUE(capturer_->GetCaptureFormat() == NULL); 474 ASSERT_TRUE(capturer_->GetCaptureFormat() == NULL);
455 } 475 }
456 476
457 TEST_F(VideoCapturerTrackSourceTest, OptionalSubOneFpsConstraints) { 477 TEST_F(VideoCapturerTrackSourceTest, OptionalSubOneFpsConstraints) {
458 FakeConstraints constraints; 478 FakeConstraints constraints;
459 constraints.AddOptional(MediaConstraintsInterface::kMaxFrameRate, 0.5); 479 constraints.AddOptional(MediaConstraintsInterface::kMaxFrameRate, 0.5);
460 480
461 CreateVideoCapturerSource(&constraints); 481 CreateVideoCapturerSource(&constraints);
462 EXPECT_EQ_WAIT(MediaSourceInterface::kLive, state_observer_->state(), 482 EXPECT_EQ_WAIT(MediaSourceInterface::kLive, state_observer_->state(),
463 kMaxWaitMs); 483 kMaxWaitMs);
464 const cricket::VideoFormat* format = capturer_->GetCaptureFormat(); 484 const cricket::VideoFormat* format = capturer_->GetCaptureFormat();
465 ASSERT_TRUE(format != NULL); 485 ASSERT_TRUE(format != NULL);
466 EXPECT_EQ(30, format->framerate()); 486 EXPECT_EQ(30, format->framerate());
467 } 487 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698