| Index: webrtc/api/videocapturertracksource_unittest.cc
|
| diff --git a/webrtc/api/videosource_unittest.cc b/webrtc/api/videocapturertracksource_unittest.cc
|
| similarity index 72%
|
| rename from webrtc/api/videosource_unittest.cc
|
| rename to webrtc/api/videocapturertracksource_unittest.cc
|
| index cfa1e721b8e61ab49fcbc94d3d10b48a33c11280..e059ef312c0315eac2f1f9890825e27b597043ad 100644
|
| --- a/webrtc/api/videosource_unittest.cc
|
| +++ b/webrtc/api/videocapturertracksource_unittest.cc
|
| @@ -13,7 +13,7 @@
|
|
|
| #include "webrtc/api/remotevideocapturer.h"
|
| #include "webrtc/api/test/fakeconstraints.h"
|
| -#include "webrtc/api/videosource.h"
|
| +#include "webrtc/api/videocapturertracksource.h"
|
| #include "webrtc/base/gunit.h"
|
| #include "webrtc/media/base/fakemediaengine.h"
|
| #include "webrtc/media/base/fakevideocapturer.h"
|
| @@ -21,11 +21,11 @@
|
| #include "webrtc/media/engine/webrtcvideoframe.h"
|
|
|
| using webrtc::FakeConstraints;
|
| -using webrtc::VideoSource;
|
| +using webrtc::VideoCapturerTrackSource;
|
| using webrtc::MediaConstraintsInterface;
|
| using webrtc::MediaSourceInterface;
|
| using webrtc::ObserverInterface;
|
| -using webrtc::VideoSourceInterface;
|
| +using webrtc::VideoTrackSourceInterface;
|
|
|
| namespace {
|
|
|
| @@ -34,27 +34,30 @@ const int kMaxWaitMs = 100;
|
|
|
| } // anonymous namespace
|
|
|
| -
|
| // TestVideoCapturer extends cricket::FakeVideoCapturer so it can be used for
|
| // testing without known camera formats.
|
| // It keeps its own lists of cricket::VideoFormats for the unit tests in this
|
| // file.
|
| class TestVideoCapturer : public cricket::FakeVideoCapturer {
|
| public:
|
| - TestVideoCapturer(bool is_screencast)
|
| - : FakeVideoCapturer(is_screencast),
|
| - test_without_formats_(false) {
|
| + explicit TestVideoCapturer(bool is_screencast)
|
| + : FakeVideoCapturer(is_screencast), test_without_formats_(false) {
|
| std::vector<cricket::VideoFormat> formats;
|
| - formats.push_back(cricket::VideoFormat(1280, 720,
|
| - cricket::VideoFormat::FpsToInterval(30), cricket::FOURCC_I420));
|
| - formats.push_back(cricket::VideoFormat(640, 480,
|
| - cricket::VideoFormat::FpsToInterval(30), cricket::FOURCC_I420));
|
| - formats.push_back(cricket::VideoFormat(640, 400,
|
| - cricket::VideoFormat::FpsToInterval(30), cricket::FOURCC_I420));
|
| - formats.push_back(cricket::VideoFormat(320, 240,
|
| - cricket::VideoFormat::FpsToInterval(30), cricket::FOURCC_I420));
|
| - formats.push_back(cricket::VideoFormat(352, 288,
|
| - cricket::VideoFormat::FpsToInterval(30), cricket::FOURCC_I420));
|
| + formats.push_back(
|
| + cricket::VideoFormat(1280, 720, cricket::VideoFormat::FpsToInterval(30),
|
| + cricket::FOURCC_I420));
|
| + formats.push_back(
|
| + cricket::VideoFormat(640, 480, cricket::VideoFormat::FpsToInterval(30),
|
| + cricket::FOURCC_I420));
|
| + formats.push_back(
|
| + cricket::VideoFormat(640, 400, cricket::VideoFormat::FpsToInterval(30),
|
| + cricket::FOURCC_I420));
|
| + formats.push_back(
|
| + cricket::VideoFormat(320, 240, cricket::VideoFormat::FpsToInterval(30),
|
| + cricket::FOURCC_I420));
|
| + formats.push_back(
|
| + cricket::VideoFormat(352, 288, cricket::VideoFormat::FpsToInterval(30),
|
| + cricket::FOURCC_I420));
|
| ResetSupportedFormats(formats);
|
| }
|
|
|
| @@ -84,8 +87,7 @@ class TestVideoCapturer : public cricket::FakeVideoCapturer {
|
| *best_format = desired;
|
| return true;
|
| }
|
| - return FakeVideoCapturer::GetBestCaptureFormat(desired,
|
| - best_format);
|
| + return FakeVideoCapturer::GetBestCaptureFormat(desired, best_format);
|
| }
|
|
|
| private:
|
| @@ -94,25 +96,19 @@ class TestVideoCapturer : public cricket::FakeVideoCapturer {
|
|
|
| class StateObserver : public ObserverInterface {
|
| public:
|
| - explicit StateObserver(VideoSourceInterface* source)
|
| - : state_(source->state()),
|
| - source_(source) {
|
| - }
|
| - virtual void OnChanged() {
|
| - state_ = source_->state();
|
| - }
|
| + explicit StateObserver(VideoTrackSourceInterface* source)
|
| + : state_(source->state()), source_(source) {}
|
| + virtual void OnChanged() { state_ = source_->state(); }
|
| MediaSourceInterface::SourceState state() const { return state_; }
|
|
|
| private:
|
| MediaSourceInterface::SourceState state_;
|
| - rtc::scoped_refptr<VideoSourceInterface> source_;
|
| + rtc::scoped_refptr<VideoTrackSourceInterface> source_;
|
| };
|
|
|
| -class VideoSourceTest : public testing::Test {
|
| +class VideoCapturerTrackSourceTest : public testing::Test {
|
| protected:
|
| - VideoSourceTest() {
|
| - InitCapturer(false);
|
| - }
|
| + VideoCapturerTrackSourceTest() { InitCapturer(false); }
|
| void InitCapturer(bool is_screencast) {
|
| capturer_cleanup_ = rtc::scoped_ptr<TestVideoCapturer>(
|
| new TestVideoCapturer(is_screencast));
|
| @@ -121,16 +117,14 @@ class VideoSourceTest : public testing::Test {
|
|
|
| void InitScreencast() { InitCapturer(true); }
|
|
|
| - void CreateVideoSource() {
|
| - CreateVideoSource(NULL);
|
| - }
|
| + void CreateVideoCapturerSource() { CreateVideoCapturerSource(NULL); }
|
|
|
| - void CreateVideoSource(
|
| + void CreateVideoCapturerSource(
|
| const webrtc::MediaConstraintsInterface* constraints) {
|
| // VideoSource take ownership of |capturer_|
|
| - source_ =
|
| - VideoSource::Create(rtc::Thread::Current(), capturer_cleanup_.release(),
|
| - constraints, false);
|
| + source_ = VideoCapturerTrackSource::Create(rtc::Thread::Current(),
|
| + capturer_cleanup_.release(),
|
| + constraints, false);
|
|
|
| ASSERT_TRUE(source_.get() != NULL);
|
| EXPECT_EQ(capturer_, source_->GetVideoCapturer());
|
| @@ -144,16 +138,15 @@ class VideoSourceTest : public testing::Test {
|
| TestVideoCapturer* capturer_;
|
| cricket::FakeVideoRenderer renderer_;
|
| rtc::scoped_ptr<StateObserver> state_observer_;
|
| - rtc::scoped_refptr<VideoSource> source_;
|
| + rtc::scoped_refptr<VideoTrackSourceInterface> source_;
|
| };
|
|
|
| -
|
| // Test that a VideoSource transition to kLive state when the capture
|
| // device have started and kEnded if it is stopped.
|
| // It also test that an output can receive video frames.
|
| -TEST_F(VideoSourceTest, CapturerStartStop) {
|
| +TEST_F(VideoCapturerTrackSourceTest, CapturerStartStop) {
|
| // Initialize without constraints.
|
| - CreateVideoSource();
|
| + CreateVideoCapturerSource();
|
| EXPECT_EQ_WAIT(MediaSourceInterface::kLive, state_observer_->state(),
|
| kMaxWaitMs);
|
|
|
| @@ -166,9 +159,9 @@ TEST_F(VideoSourceTest, CapturerStartStop) {
|
| }
|
|
|
| // Test that a VideoSource can be stopped and restarted.
|
| -TEST_F(VideoSourceTest, StopRestart) {
|
| +TEST_F(VideoCapturerTrackSourceTest, StopRestart) {
|
| // Initialize without constraints.
|
| - CreateVideoSource();
|
| + CreateVideoCapturerSource();
|
| EXPECT_EQ_WAIT(MediaSourceInterface::kLive, state_observer_->state(),
|
| kMaxWaitMs);
|
|
|
| @@ -191,9 +184,9 @@ TEST_F(VideoSourceTest, StopRestart) {
|
|
|
| // Test start stop with a remote VideoSource - the video source that has a
|
| // RemoteVideoCapturer and takes video frames from FrameInput.
|
| -TEST_F(VideoSourceTest, StartStopRemote) {
|
| - source_ = VideoSource::Create(rtc::Thread::Current(),
|
| - new webrtc::RemoteVideoCapturer(), NULL, true);
|
| +TEST_F(VideoCapturerTrackSourceTest, StartStopRemote) {
|
| + source_ = VideoCapturerTrackSource::Create(
|
| + rtc::Thread::Current(), new webrtc::RemoteVideoCapturer(), NULL, true);
|
|
|
| ASSERT_TRUE(source_.get() != NULL);
|
| EXPECT_TRUE(NULL != source_->GetVideoCapturer());
|
| @@ -212,8 +205,8 @@ TEST_F(VideoSourceTest, StartStopRemote) {
|
|
|
| // Test that a VideoSource transition to kEnded if the capture device
|
| // fails.
|
| -TEST_F(VideoSourceTest, CameraFailed) {
|
| - CreateVideoSource();
|
| +TEST_F(VideoCapturerTrackSourceTest, CameraFailed) {
|
| + CreateVideoCapturerSource();
|
| EXPECT_EQ_WAIT(MediaSourceInterface::kLive, state_observer_->state(),
|
| kMaxWaitMs);
|
|
|
| @@ -224,13 +217,13 @@ TEST_F(VideoSourceTest, CameraFailed) {
|
|
|
| // Test that the capture output is CIF if we set max constraints to CIF.
|
| // and the capture device support CIF.
|
| -TEST_F(VideoSourceTest, MandatoryConstraintCif5Fps) {
|
| +TEST_F(VideoCapturerTrackSourceTest, MandatoryConstraintCif5Fps) {
|
| FakeConstraints constraints;
|
| constraints.AddMandatory(MediaConstraintsInterface::kMaxWidth, 352);
|
| constraints.AddMandatory(MediaConstraintsInterface::kMaxHeight, 288);
|
| constraints.AddMandatory(MediaConstraintsInterface::kMaxFrameRate, 5);
|
|
|
| - CreateVideoSource(&constraints);
|
| + CreateVideoCapturerSource(&constraints);
|
| EXPECT_EQ_WAIT(MediaSourceInterface::kLive, state_observer_->state(),
|
| kMaxWaitMs);
|
| const cricket::VideoFormat* format = capturer_->GetCaptureFormat();
|
| @@ -242,7 +235,7 @@ TEST_F(VideoSourceTest, MandatoryConstraintCif5Fps) {
|
|
|
| // Test that the capture output is 720P if the camera support it and the
|
| // optional constraint is set to 720P.
|
| -TEST_F(VideoSourceTest, MandatoryMinVgaOptional720P) {
|
| +TEST_F(VideoCapturerTrackSourceTest, MandatoryMinVgaOptional720P) {
|
| FakeConstraints constraints;
|
| constraints.AddMandatory(MediaConstraintsInterface::kMinWidth, 640);
|
| constraints.AddMandatory(MediaConstraintsInterface::kMinHeight, 480);
|
| @@ -250,7 +243,7 @@ TEST_F(VideoSourceTest, MandatoryMinVgaOptional720P) {
|
| constraints.AddOptional(MediaConstraintsInterface::kMinAspectRatio,
|
| 1280.0 / 720);
|
|
|
| - CreateVideoSource(&constraints);
|
| + CreateVideoCapturerSource(&constraints);
|
| EXPECT_EQ_WAIT(MediaSourceInterface::kLive, state_observer_->state(),
|
| kMaxWaitMs);
|
| const cricket::VideoFormat* format = capturer_->GetCaptureFormat();
|
| @@ -263,7 +256,7 @@ TEST_F(VideoSourceTest, MandatoryMinVgaOptional720P) {
|
| // Test that the capture output have aspect ratio 4:3 if a mandatory constraint
|
| // require it even if an optional constraint request a higher resolution
|
| // that don't have this aspect ratio.
|
| -TEST_F(VideoSourceTest, MandatoryAspectRatio4To3) {
|
| +TEST_F(VideoCapturerTrackSourceTest, MandatoryAspectRatio4To3) {
|
| FakeConstraints constraints;
|
| constraints.AddMandatory(MediaConstraintsInterface::kMinWidth, 640);
|
| constraints.AddMandatory(MediaConstraintsInterface::kMinHeight, 480);
|
| @@ -271,7 +264,7 @@ TEST_F(VideoSourceTest, MandatoryAspectRatio4To3) {
|
| 640.0 / 480);
|
| constraints.AddOptional(MediaConstraintsInterface::kMinWidth, 1280);
|
|
|
| - CreateVideoSource(&constraints);
|
| + CreateVideoCapturerSource(&constraints);
|
| EXPECT_EQ_WAIT(MediaSourceInterface::kLive, state_observer_->state(),
|
| kMaxWaitMs);
|
| const cricket::VideoFormat* format = capturer_->GetCaptureFormat();
|
| @@ -281,23 +274,22 @@ TEST_F(VideoSourceTest, MandatoryAspectRatio4To3) {
|
| EXPECT_EQ(30, format->framerate());
|
| }
|
|
|
| -
|
| // Test that the source state transition to kEnded if the mandatory aspect ratio
|
| // is set higher than supported.
|
| -TEST_F(VideoSourceTest, MandatoryAspectRatioTooHigh) {
|
| +TEST_F(VideoCapturerTrackSourceTest, MandatoryAspectRatioTooHigh) {
|
| FakeConstraints constraints;
|
| constraints.AddMandatory(MediaConstraintsInterface::kMinAspectRatio, 2);
|
| - CreateVideoSource(&constraints);
|
| + CreateVideoCapturerSource(&constraints);
|
| EXPECT_EQ_WAIT(MediaSourceInterface::kEnded, state_observer_->state(),
|
| kMaxWaitMs);
|
| }
|
|
|
| // Test that the source ignores an optional aspect ratio that is higher than
|
| // supported.
|
| -TEST_F(VideoSourceTest, OptionalAspectRatioTooHigh) {
|
| +TEST_F(VideoCapturerTrackSourceTest, OptionalAspectRatioTooHigh) {
|
| FakeConstraints constraints;
|
| constraints.AddOptional(MediaConstraintsInterface::kMinAspectRatio, 2);
|
| - CreateVideoSource(&constraints);
|
| + CreateVideoCapturerSource(&constraints);
|
| EXPECT_EQ_WAIT(MediaSourceInterface::kLive, state_observer_->state(),
|
| kMaxWaitMs);
|
| const cricket::VideoFormat* format = capturer_->GetCaptureFormat();
|
| @@ -308,10 +300,10 @@ TEST_F(VideoSourceTest, OptionalAspectRatioTooHigh) {
|
|
|
| // Test that the source starts video with the default resolution if the
|
| // camera doesn't support capability enumeration and there are no constraints.
|
| -TEST_F(VideoSourceTest, NoCameraCapability) {
|
| +TEST_F(VideoCapturerTrackSourceTest, NoCameraCapability) {
|
| capturer_->TestWithoutCameraFormats();
|
|
|
| - CreateVideoSource();
|
| + CreateVideoCapturerSource();
|
| EXPECT_EQ_WAIT(MediaSourceInterface::kLive, state_observer_->state(),
|
| kMaxWaitMs);
|
| const cricket::VideoFormat* format = capturer_->GetCaptureFormat();
|
| @@ -324,7 +316,7 @@ TEST_F(VideoSourceTest, NoCameraCapability) {
|
| // Test that the source can start the video and get the requested aspect ratio
|
| // if the camera doesn't support capability enumeration and the aspect ratio is
|
| // set.
|
| -TEST_F(VideoSourceTest, NoCameraCapability16To9Ratio) {
|
| +TEST_F(VideoCapturerTrackSourceTest, NoCameraCapability16To9Ratio) {
|
| capturer_->TestWithoutCameraFormats();
|
|
|
| FakeConstraints constraints;
|
| @@ -333,7 +325,7 @@ TEST_F(VideoSourceTest, NoCameraCapability16To9Ratio) {
|
| constraints.AddMandatory(MediaConstraintsInterface::kMinAspectRatio,
|
| requested_aspect_ratio);
|
|
|
| - CreateVideoSource(&constraints);
|
| + CreateVideoCapturerSource(&constraints);
|
| EXPECT_EQ_WAIT(MediaSourceInterface::kLive, state_observer_->state(),
|
| kMaxWaitMs);
|
| const cricket::VideoFormat* format = capturer_->GetCaptureFormat();
|
| @@ -343,121 +335,113 @@ TEST_F(VideoSourceTest, NoCameraCapability16To9Ratio) {
|
|
|
| // Test that the source state transitions to kEnded if an unknown mandatory
|
| // constraint is found.
|
| -TEST_F(VideoSourceTest, InvalidMandatoryConstraint) {
|
| +TEST_F(VideoCapturerTrackSourceTest, InvalidMandatoryConstraint) {
|
| FakeConstraints constraints;
|
| constraints.AddMandatory("weird key", 640);
|
|
|
| - CreateVideoSource(&constraints);
|
| + CreateVideoCapturerSource(&constraints);
|
| EXPECT_EQ_WAIT(MediaSourceInterface::kEnded, state_observer_->state(),
|
| kMaxWaitMs);
|
| }
|
|
|
| // Test that the source ignores an unknown optional constraint.
|
| -TEST_F(VideoSourceTest, InvalidOptionalConstraint) {
|
| +TEST_F(VideoCapturerTrackSourceTest, InvalidOptionalConstraint) {
|
| FakeConstraints constraints;
|
| constraints.AddOptional("weird key", 640);
|
|
|
| - CreateVideoSource(&constraints);
|
| + CreateVideoCapturerSource(&constraints);
|
| EXPECT_EQ_WAIT(MediaSourceInterface::kLive, state_observer_->state(),
|
| kMaxWaitMs);
|
| }
|
|
|
| -TEST_F(VideoSourceTest, SetValidOptionValues) {
|
| +TEST_F(VideoCapturerTrackSourceTest, SetValidOptionValues) {
|
| FakeConstraints constraints;
|
| constraints.AddMandatory(MediaConstraintsInterface::kNoiseReduction, "false");
|
|
|
| - CreateVideoSource(&constraints);
|
| + CreateVideoCapturerSource(&constraints);
|
|
|
| EXPECT_EQ(rtc::Optional<bool>(false),
|
| source_->options()->video_noise_reduction);
|
| }
|
|
|
| -TEST_F(VideoSourceTest, OptionNotSet) {
|
| +TEST_F(VideoCapturerTrackSourceTest, OptionNotSet) {
|
| FakeConstraints constraints;
|
| - CreateVideoSource(&constraints);
|
| + CreateVideoCapturerSource(&constraints);
|
| EXPECT_EQ(rtc::Optional<bool>(), source_->options()->video_noise_reduction);
|
| }
|
|
|
| -TEST_F(VideoSourceTest, MandatoryOptionOverridesOptional) {
|
| +TEST_F(VideoCapturerTrackSourceTest, MandatoryOptionOverridesOptional) {
|
| FakeConstraints constraints;
|
| - constraints.AddMandatory(
|
| - MediaConstraintsInterface::kNoiseReduction, true);
|
| - constraints.AddOptional(
|
| - MediaConstraintsInterface::kNoiseReduction, false);
|
| + constraints.AddMandatory(MediaConstraintsInterface::kNoiseReduction, true);
|
| + constraints.AddOptional(MediaConstraintsInterface::kNoiseReduction, false);
|
|
|
| - CreateVideoSource(&constraints);
|
| + CreateVideoCapturerSource(&constraints);
|
|
|
| EXPECT_EQ(rtc::Optional<bool>(true),
|
| source_->options()->video_noise_reduction);
|
| }
|
|
|
| -TEST_F(VideoSourceTest, InvalidOptionKeyOptional) {
|
| +TEST_F(VideoCapturerTrackSourceTest, InvalidOptionKeyOptional) {
|
| FakeConstraints constraints;
|
| - constraints.AddOptional(
|
| - MediaConstraintsInterface::kNoiseReduction, false);
|
| + constraints.AddOptional(MediaConstraintsInterface::kNoiseReduction, false);
|
| constraints.AddOptional("invalidKey", false);
|
|
|
| - CreateVideoSource(&constraints);
|
| + CreateVideoCapturerSource(&constraints);
|
|
|
| EXPECT_EQ_WAIT(MediaSourceInterface::kLive, state_observer_->state(),
|
| - kMaxWaitMs);
|
| + kMaxWaitMs);
|
| EXPECT_EQ(rtc::Optional<bool>(false),
|
| source_->options()->video_noise_reduction);
|
| }
|
|
|
| -TEST_F(VideoSourceTest, InvalidOptionKeyMandatory) {
|
| +TEST_F(VideoCapturerTrackSourceTest, InvalidOptionKeyMandatory) {
|
| FakeConstraints constraints;
|
| - constraints.AddMandatory(
|
| - MediaConstraintsInterface::kNoiseReduction, false);
|
| + constraints.AddMandatory(MediaConstraintsInterface::kNoiseReduction, false);
|
| constraints.AddMandatory("invalidKey", false);
|
|
|
| - CreateVideoSource(&constraints);
|
| + CreateVideoCapturerSource(&constraints);
|
|
|
| EXPECT_EQ_WAIT(MediaSourceInterface::kEnded, state_observer_->state(),
|
| - kMaxWaitMs);
|
| + kMaxWaitMs);
|
| EXPECT_EQ(rtc::Optional<bool>(), source_->options()->video_noise_reduction);
|
| }
|
|
|
| -TEST_F(VideoSourceTest, InvalidOptionValueOptional) {
|
| +TEST_F(VideoCapturerTrackSourceTest, InvalidOptionValueOptional) {
|
| FakeConstraints constraints;
|
| - constraints.AddOptional(
|
| - MediaConstraintsInterface::kNoiseReduction, "not a boolean");
|
| + constraints.AddOptional(MediaConstraintsInterface::kNoiseReduction,
|
| + "not a boolean");
|
|
|
| - CreateVideoSource(&constraints);
|
| + CreateVideoCapturerSource(&constraints);
|
|
|
| EXPECT_EQ_WAIT(MediaSourceInterface::kLive, state_observer_->state(),
|
| - kMaxWaitMs);
|
| + kMaxWaitMs);
|
| EXPECT_EQ(rtc::Optional<bool>(), source_->options()->video_noise_reduction);
|
| }
|
|
|
| -TEST_F(VideoSourceTest, InvalidOptionValueMandatory) {
|
| +TEST_F(VideoCapturerTrackSourceTest, InvalidOptionValueMandatory) {
|
| FakeConstraints constraints;
|
| // Optional constraints should be ignored if the mandatory constraints fail.
|
| - constraints.AddOptional(
|
| - MediaConstraintsInterface::kNoiseReduction, "false");
|
| + constraints.AddOptional(MediaConstraintsInterface::kNoiseReduction, "false");
|
| // Values are case-sensitive and must be all lower-case.
|
| - constraints.AddMandatory(
|
| - MediaConstraintsInterface::kNoiseReduction, "True");
|
| + constraints.AddMandatory(MediaConstraintsInterface::kNoiseReduction, "True");
|
|
|
| - CreateVideoSource(&constraints);
|
| + CreateVideoCapturerSource(&constraints);
|
|
|
| EXPECT_EQ_WAIT(MediaSourceInterface::kEnded, state_observer_->state(),
|
| - kMaxWaitMs);
|
| + kMaxWaitMs);
|
| EXPECT_EQ(rtc::Optional<bool>(), source_->options()->video_noise_reduction);
|
| }
|
|
|
| -TEST_F(VideoSourceTest, MixedOptionsAndConstraints) {
|
| +TEST_F(VideoCapturerTrackSourceTest, MixedOptionsAndConstraints) {
|
| FakeConstraints constraints;
|
| constraints.AddMandatory(MediaConstraintsInterface::kMaxWidth, 352);
|
| constraints.AddMandatory(MediaConstraintsInterface::kMaxHeight, 288);
|
| constraints.AddOptional(MediaConstraintsInterface::kMaxFrameRate, 5);
|
|
|
| - constraints.AddMandatory(
|
| - MediaConstraintsInterface::kNoiseReduction, false);
|
| - constraints.AddOptional(
|
| - MediaConstraintsInterface::kNoiseReduction, true);
|
| + constraints.AddMandatory(MediaConstraintsInterface::kNoiseReduction, false);
|
| + constraints.AddOptional(MediaConstraintsInterface::kNoiseReduction, true);
|
|
|
| - CreateVideoSource(&constraints);
|
| + CreateVideoCapturerSource(&constraints);
|
| EXPECT_EQ_WAIT(MediaSourceInterface::kLive, state_observer_->state(),
|
| kMaxWaitMs);
|
| const cricket::VideoFormat* format = capturer_->GetCaptureFormat();
|
| @@ -472,11 +456,11 @@ TEST_F(VideoSourceTest, MixedOptionsAndConstraints) {
|
|
|
| // Tests that the source starts video with the default resolution for
|
| // screencast if no constraint is set.
|
| -TEST_F(VideoSourceTest, ScreencastResolutionNoConstraint) {
|
| +TEST_F(VideoCapturerTrackSourceTest, ScreencastResolutionNoConstraint) {
|
| InitScreencast();
|
| capturer_->TestWithoutCameraFormats();
|
|
|
| - CreateVideoSource();
|
| + CreateVideoCapturerSource();
|
| EXPECT_EQ_WAIT(MediaSourceInterface::kLive, state_observer_->state(),
|
| kMaxWaitMs);
|
| const cricket::VideoFormat* format = capturer_->GetCaptureFormat();
|
| @@ -488,7 +472,7 @@ TEST_F(VideoSourceTest, ScreencastResolutionNoConstraint) {
|
|
|
| // Tests that the source starts video with the max width and height set by
|
| // constraints for screencast.
|
| -TEST_F(VideoSourceTest, ScreencastResolutionWithConstraint) {
|
| +TEST_F(VideoCapturerTrackSourceTest, ScreencastResolutionWithConstraint) {
|
| FakeConstraints constraints;
|
| constraints.AddMandatory(MediaConstraintsInterface::kMaxWidth, 480);
|
| constraints.AddMandatory(MediaConstraintsInterface::kMaxHeight, 270);
|
| @@ -496,7 +480,7 @@ TEST_F(VideoSourceTest, ScreencastResolutionWithConstraint) {
|
| InitScreencast();
|
| capturer_->TestWithoutCameraFormats();
|
|
|
| - CreateVideoSource(&constraints);
|
| + CreateVideoCapturerSource(&constraints);
|
| EXPECT_EQ_WAIT(MediaSourceInterface::kLive, state_observer_->state(),
|
| kMaxWaitMs);
|
| const cricket::VideoFormat* format = capturer_->GetCaptureFormat();
|
| @@ -506,21 +490,21 @@ TEST_F(VideoSourceTest, ScreencastResolutionWithConstraint) {
|
| EXPECT_EQ(30, format->framerate());
|
| }
|
|
|
| -TEST_F(VideoSourceTest, MandatorySubOneFpsConstraints) {
|
| +TEST_F(VideoCapturerTrackSourceTest, MandatorySubOneFpsConstraints) {
|
| FakeConstraints constraints;
|
| constraints.AddMandatory(MediaConstraintsInterface::kMaxFrameRate, 0.5);
|
|
|
| - CreateVideoSource(&constraints);
|
| + CreateVideoCapturerSource(&constraints);
|
| EXPECT_EQ_WAIT(MediaSourceInterface::kEnded, state_observer_->state(),
|
| kMaxWaitMs);
|
| ASSERT_TRUE(capturer_->GetCaptureFormat() == NULL);
|
| }
|
|
|
| -TEST_F(VideoSourceTest, OptionalSubOneFpsConstraints) {
|
| +TEST_F(VideoCapturerTrackSourceTest, OptionalSubOneFpsConstraints) {
|
| FakeConstraints constraints;
|
| constraints.AddOptional(MediaConstraintsInterface::kMaxFrameRate, 0.5);
|
|
|
| - CreateVideoSource(&constraints);
|
| + CreateVideoCapturerSource(&constraints);
|
| EXPECT_EQ_WAIT(MediaSourceInterface::kLive, state_observer_->state(),
|
| kMaxWaitMs);
|
| const cricket::VideoFormat* format = capturer_->GetCaptureFormat();
|
|
|