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

Unified Diff: webrtc/media/webrtc/webrtcvideoengine2_unittest.cc

Issue 1670153003: Introduce struct MediaConfig, with construction-time settings. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Split into three separate tests. Created 4 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: webrtc/media/webrtc/webrtcvideoengine2_unittest.cc
diff --git a/webrtc/media/webrtc/webrtcvideoengine2_unittest.cc b/webrtc/media/webrtc/webrtcvideoengine2_unittest.cc
index 7a7c81535c5d4b3d7bb0b472e12248e1d7c1e2b2..3e57d87302c13000b4330ee72452c17b8916ba71 100644
--- a/webrtc/media/webrtc/webrtcvideoengine2_unittest.cc
+++ b/webrtc/media/webrtc/webrtcvideoengine2_unittest.cc
@@ -300,7 +300,7 @@ TEST_F(WebRtcVideoEngine2Test, CVOSetHeaderExtensionAfterCapturer) {
TEST_F(WebRtcVideoEngine2Test, SetSendFailsBeforeSettingCodecs) {
engine_.Init();
rtc::scoped_ptr<VideoMediaChannel> channel(
- engine_.CreateChannel(call_.get(), cricket::VideoOptions()));
+ engine_.CreateChannel(call_.get(), MediaConfig(), VideoOptions()));
EXPECT_TRUE(channel->AddSendStream(StreamParams::CreateLegacy(123)));
@@ -313,7 +313,7 @@ TEST_F(WebRtcVideoEngine2Test, SetSendFailsBeforeSettingCodecs) {
TEST_F(WebRtcVideoEngine2Test, GetStatsWithoutSendCodecsSetDoesNotCrash) {
engine_.Init();
rtc::scoped_ptr<VideoMediaChannel> channel(
- engine_.CreateChannel(call_.get(), cricket::VideoOptions()));
+ engine_.CreateChannel(call_.get(), MediaConfig(), VideoOptions()));
EXPECT_TRUE(channel->AddSendStream(StreamParams::CreateLegacy(123)));
VideoMediaInfo info;
channel->GetStats(&info);
@@ -492,7 +492,7 @@ VideoMediaChannel* WebRtcVideoEngine2Test::SetUpForExternalEncoderFactory(
engine_.Init();
VideoMediaChannel* channel =
- engine_.CreateChannel(call_.get(), cricket::VideoOptions());
+ engine_.CreateChannel(call_.get(), MediaConfig(), VideoOptions());
cricket::VideoSendParameters parameters;
parameters.codecs = codecs;
EXPECT_TRUE(channel->SetSendParameters(parameters));
@@ -507,7 +507,7 @@ VideoMediaChannel* WebRtcVideoEngine2Test::SetUpForExternalDecoderFactory(
engine_.Init();
VideoMediaChannel* channel =
- engine_.CreateChannel(call_.get(), cricket::VideoOptions());
+ engine_.CreateChannel(call_.get(), MediaConfig(), VideoOptions());
cricket::VideoRecvParameters parameters;
parameters.codecs = codecs;
EXPECT_TRUE(channel->SetRecvParameters(parameters));
@@ -827,7 +827,7 @@ class WebRtcVideoChannel2Test : public WebRtcVideoEngine2Test {
fake_call_.reset(new FakeCall(webrtc::Call::Config()));
engine_.Init();
channel_.reset(
- engine_.CreateChannel(fake_call_.get(), cricket::VideoOptions()));
+ engine_.CreateChannel(fake_call_.get(), MediaConfig(), VideoOptions()));
last_ssrc_ = 123;
send_parameters_.codecs = engine_.codecs();
recv_parameters_.codecs = engine_.codecs();
@@ -1716,9 +1716,14 @@ void WebRtcVideoChannel2Test::TestCpuAdaptation(bool enable_overuse,
cricket::VideoCodec codec = kVp8Codec720p;
cricket::VideoSendParameters parameters;
parameters.codecs.push_back(codec);
+
+ MediaConfig media_config = MediaConfig();
if (!enable_overuse) {
- parameters.options.cpu_overuse_detection = rtc::Optional<bool>(false);
+ media_config.enable_cpu_overuse_detection = false;
}
+ channel_.reset(
+ engine_.CreateChannel(fake_call_.get(), media_config, VideoOptions()));
+
EXPECT_TRUE(channel_->SetSendParameters(parameters));
AddSendStream();
@@ -2245,21 +2250,25 @@ TEST_F(WebRtcVideoChannel2Test, SetSend) {
TEST_F(WebRtcVideoChannel2Test, TestSetDscpOptions) {
rtc::scoped_ptr<cricket::FakeNetworkInterface> network_interface(
new cricket::FakeNetworkInterface);
- channel_->SetInterface(network_interface.get());
- cricket::VideoSendParameters parameters = send_parameters_;
- EXPECT_TRUE(channel_->SetSendParameters(parameters));
- EXPECT_EQ(rtc::DSCP_NO_CHANGE, network_interface->dscp());
- parameters.options.dscp = rtc::Optional<bool>(true);
- EXPECT_TRUE(channel_->SetSendParameters(parameters));
- EXPECT_EQ(rtc::DSCP_AF41, network_interface->dscp());
- // Verify previous value is not modified if dscp option is not set.
- cricket::VideoSendParameters parameters1 = send_parameters_;
- EXPECT_TRUE(channel_->SetSendParameters(parameters1));
+ MediaConfig config;
+ rtc::scoped_ptr<VideoMediaChannel> channel;
+
+ channel.reset(engine_.CreateChannel(call_.get(), config, VideoOptions()));
+ channel->SetInterface(network_interface.get());
+ // Default value when DSCP is disabled should be DSCP_DEFAULT.
+ EXPECT_EQ(rtc::DSCP_DEFAULT, network_interface->dscp());
+
+ config.enable_dscp = true;
+ channel.reset(engine_.CreateChannel(call_.get(), config, VideoOptions()));
+ channel->SetInterface(network_interface.get());
EXPECT_EQ(rtc::DSCP_AF41, network_interface->dscp());
- parameters1.options.dscp = rtc::Optional<bool>(false);
- EXPECT_TRUE(channel_->SetSendParameters(parameters1));
+
+ // Verify that setting the option to false resets the
+ // DiffServCodePoint.
+ config.enable_dscp = false;
+ channel.reset(engine_.CreateChannel(call_.get(), config, VideoOptions()));
+ channel->SetInterface(network_interface.get());
EXPECT_EQ(rtc::DSCP_DEFAULT, network_interface->dscp());
- channel_->SetInterface(NULL);
}
// This test verifies that the RTCP reduced size mode is properly applied to
@@ -2382,8 +2391,6 @@ TEST_F(WebRtcVideoChannel2Test, GetStatsTracksAdaptationStats) {
EXPECT_TRUE(channel_->SetSend(true));
// Verify that the CpuOveruseObserver is registered and trigger downgrade.
- parameters.options.cpu_overuse_detection = rtc::Optional<bool>(true);
- EXPECT_TRUE(channel_->SetSendParameters(parameters));
// Trigger overuse.
ASSERT_EQ(1u, fake_call_->GetVideoSendStreams().size());
@@ -2459,8 +2466,6 @@ TEST_F(WebRtcVideoChannel2Test, GetStatsTracksAdaptationAndBandwidthStats) {
EXPECT_TRUE(channel_->SetSend(true));
// Verify that the CpuOveruseObserver is registered and trigger downgrade.
- parameters.options.cpu_overuse_detection = rtc::Optional<bool>(true);
- EXPECT_TRUE(channel_->SetSendParameters(parameters));
// Trigger overuse -> adapt CPU.
ASSERT_EQ(1u, fake_call_->GetVideoSendStreams().size());
@@ -2920,7 +2925,8 @@ class WebRtcVideoChannel2SimulcastTest : public testing::Test {
void SetUp() override {
engine_.Init();
- channel_.reset(engine_.CreateChannel(&fake_call_, VideoOptions()));
+ channel_.reset(engine_.CreateChannel(
+ &fake_call_, MediaConfig(), VideoOptions()));
last_ssrc_ = 123;
}

Powered by Google App Engine
This is Rietveld 408576698