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

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

Issue 1670153003: Introduce struct MediaConfig, with construction-time settings. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Added new peerconnection test for dscp constraint. 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/webrtcvoiceengine_unittest.cc
diff --git a/webrtc/media/webrtc/webrtcvoiceengine_unittest.cc b/webrtc/media/webrtc/webrtcvoiceengine_unittest.cc
index 987567a34b291a8a5f0dd295335c89b5ca46486f..d9dd714c5a5598cf26ed20d2b96aec466e56f2e9 100644
--- a/webrtc/media/webrtc/webrtcvoiceengine_unittest.cc
+++ b/webrtc/media/webrtc/webrtcvoiceengine_unittest.cc
@@ -94,7 +94,8 @@ class WebRtcVoiceEngineTestFake : public testing::Test {
if (!engine_.Init(rtc::Thread::Current())) {
return false;
}
- channel_ = engine_.CreateChannel(&call_, cricket::AudioOptions());
+ channel_ = engine_.CreateChannel(
+ &call_, cricket::MediaConfig(), cricket::AudioOptions());
return (channel_ != nullptr);
}
bool SetupEngineWithRecvStream() {
@@ -154,7 +155,8 @@ class WebRtcVoiceEngineTestFake : public testing::Test {
void TestInsertDtmf(uint32_t ssrc, bool caller) {
EXPECT_TRUE(engine_.Init(rtc::Thread::Current()));
- channel_ = engine_.CreateChannel(&call_, cricket::AudioOptions());
+ channel_ = engine_.CreateChannel(
+ &call_, cricket::MediaConfig(), cricket::AudioOptions());
EXPECT_TRUE(channel_ != nullptr);
if (caller) {
// If this is a caller, local description will be applied and add the
@@ -431,7 +433,8 @@ TEST_F(WebRtcVoiceEngineTestFake, StartupShutdown) {
// Tests that we can create and destroy a channel.
TEST_F(WebRtcVoiceEngineTestFake, CreateChannel) {
EXPECT_TRUE(engine_.Init(rtc::Thread::Current()));
- channel_ = engine_.CreateChannel(&call_, cricket::AudioOptions());
+ channel_ = engine_.CreateChannel(
+ &call_, cricket::MediaConfig(), cricket::AudioOptions());
EXPECT_TRUE(channel_ != nullptr);
}
@@ -1718,7 +1721,8 @@ TEST_F(WebRtcVoiceEngineTestFake, SetSendCodecsCNandDTMFAsCaller) {
// Test that we set VAD and DTMF types correctly as callee.
TEST_F(WebRtcVoiceEngineTestFake, SetSendCodecsCNandDTMFAsCallee) {
EXPECT_TRUE(engine_.Init(rtc::Thread::Current()));
- channel_ = engine_.CreateChannel(&call_, cricket::AudioOptions());
+ channel_ = engine_.CreateChannel(
+ &call_, cricket::MediaConfig(), cricket::AudioOptions());
EXPECT_TRUE(channel_ != nullptr);
cricket::AudioSendParameters parameters;
@@ -1835,7 +1839,8 @@ TEST_F(WebRtcVoiceEngineTestFake, SetSendCodecsREDAsCaller) {
// Test that we set up RED correctly as callee.
TEST_F(WebRtcVoiceEngineTestFake, SetSendCodecsREDAsCallee) {
EXPECT_TRUE(engine_.Init(rtc::Thread::Current()));
- channel_ = engine_.CreateChannel(&call_, cricket::AudioOptions());
+ channel_ = engine_.CreateChannel(
+ &call_, cricket::MediaConfig(), cricket::AudioOptions());
EXPECT_TRUE(channel_ != nullptr);
cricket::AudioSendParameters parameters;
@@ -2366,7 +2371,8 @@ TEST_F(WebRtcVoiceEngineTestFake, SetSendSsrcWithMultipleStreams) {
// receive channel is created before the send channel.
TEST_F(WebRtcVoiceEngineTestFake, SetSendSsrcAfterCreatingReceiveChannel) {
EXPECT_TRUE(engine_.Init(rtc::Thread::Current()));
- channel_ = engine_.CreateChannel(&call_, cricket::AudioOptions());
+ channel_ = engine_.CreateChannel(
+ &call_, cricket::MediaConfig(), cricket::AudioOptions());
EXPECT_TRUE(channel_->AddRecvStream(cricket::StreamParams::CreateLegacy(1)));
int receive_channel_num = voe_.GetLastChannel();
@@ -2795,10 +2801,12 @@ TEST_F(WebRtcVoiceEngineTestFake, SetOptionOverridesViaChannels) {
EXPECT_TRUE(SetupEngineWithSendStream());
rtc::scoped_ptr<cricket::WebRtcVoiceMediaChannel> channel1(
static_cast<cricket::WebRtcVoiceMediaChannel*>(
- engine_.CreateChannel(&call_, cricket::AudioOptions())));
+ engine_.CreateChannel(
+ &call_, cricket::MediaConfig(), cricket::AudioOptions())));
rtc::scoped_ptr<cricket::WebRtcVoiceMediaChannel> channel2(
static_cast<cricket::WebRtcVoiceMediaChannel*>(
- engine_.CreateChannel(&call_, cricket::AudioOptions())));
+ engine_.CreateChannel(
+ &call_, cricket::MediaConfig(), cricket::AudioOptions())));
// Have to add a stream to make SetSend work.
cricket::StreamParams stream1;
@@ -2894,21 +2902,35 @@ TEST_F(WebRtcVoiceEngineTestFake, SetOptionOverridesViaChannels) {
// This test verifies DSCP settings are properly applied on voice media channel.
TEST_F(WebRtcVoiceEngineTestFake, TestSetDscpOptions) {
EXPECT_TRUE(SetupEngineWithSendStream());
- rtc::scoped_ptr<cricket::VoiceMediaChannel> channel(
- engine_.CreateChannel(&call_, cricket::AudioOptions()));
- rtc::scoped_ptr<cricket::FakeNetworkInterface> network_interface(
- new cricket::FakeNetworkInterface);
- channel->SetInterface(network_interface.get());
- cricket::AudioSendParameters parameters = send_parameters_;
- parameters.options.dscp = rtc::Optional<bool>(true);
- EXPECT_TRUE(channel->SetSendParameters(parameters));
- EXPECT_EQ(rtc::DSCP_EF, network_interface->dscp());
- // Verify previous value is not modified if dscp option is not set.
- EXPECT_TRUE(channel->SetSendParameters(send_parameters_));
- EXPECT_EQ(rtc::DSCP_EF, network_interface->dscp());
- parameters.options.dscp = rtc::Optional<bool>(false);
- EXPECT_TRUE(channel->SetSendParameters(parameters));
- EXPECT_EQ(rtc::DSCP_DEFAULT, network_interface->dscp());
+ cricket::FakeNetworkInterface network_interface;
+ cricket::MediaConfig config;
+ rtc::scoped_ptr<cricket::VoiceMediaChannel> channel;
+
+ channel.reset(engine_.CreateChannel(&call_,
+ config,
+ cricket::AudioOptions()));
+ channel->SetInterface(&network_interface);
+ // 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_,
+ config,
+ cricket::AudioOptions()));
+ channel->SetInterface(&network_interface);
+ EXPECT_EQ(rtc::DSCP_EF, network_interface.dscp());
+
+ // Verify that setting the option to false resets the
+ // DiffServCodePoint.
+ config.enable_dscp = false;
+ channel.reset(engine_.CreateChannel(&call_,
+ config,
+ cricket::AudioOptions()));
+ channel->SetInterface(&network_interface);
+ // Default value when DSCP is disabled should be DSCP_DEFAULT.
+ EXPECT_EQ(rtc::DSCP_DEFAULT, network_interface.dscp());
+
+ channel->SetInterface(nullptr);
}
TEST_F(WebRtcVoiceEngineTestFake, TestGetReceiveChannelId) {
@@ -3167,7 +3189,8 @@ TEST(WebRtcVoiceEngineTest, StartupShutdown) {
rtc::scoped_ptr<webrtc::Call> call(
webrtc::Call::Create(webrtc::Call::Config()));
cricket::VoiceMediaChannel* channel =
- engine.CreateChannel(call.get(), cricket::AudioOptions());
+ engine.CreateChannel(call.get(),
+ cricket::MediaConfig(), cricket::AudioOptions());
EXPECT_TRUE(channel != nullptr);
delete channel;
engine.Terminate();
@@ -3273,7 +3296,8 @@ TEST(WebRtcVoiceEngineTest, Has32Channels) {
int num_channels = 0;
while (num_channels < arraysize(channels)) {
cricket::VoiceMediaChannel* channel =
- engine.CreateChannel(call.get(), cricket::AudioOptions());
+ engine.CreateChannel(call.get(),
+ cricket::MediaConfig(), cricket::AudioOptions());
if (!channel)
break;
channels[num_channels++] = channel;
@@ -3294,7 +3318,9 @@ TEST(WebRtcVoiceEngineTest, SetRecvCodecs) {
EXPECT_TRUE(engine.Init(rtc::Thread::Current()));
rtc::scoped_ptr<webrtc::Call> call(
webrtc::Call::Create(webrtc::Call::Config()));
- cricket::WebRtcVoiceMediaChannel channel(&engine, cricket::AudioOptions(),
+ cricket::WebRtcVoiceMediaChannel channel(&engine,
+ cricket::MediaConfig(),
+ cricket::AudioOptions(),
call.get());
cricket::AudioRecvParameters parameters;
parameters.codecs = engine.codecs();
« webrtc/media/webrtc/webrtcvideoengine2.cc ('K') | « webrtc/media/webrtc/webrtcvoiceengine.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698