| 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..bf0e6b7d621585d0e0f5cc003d9ff803a2e08b12 100644
|
| --- a/webrtc/media/webrtc/webrtcvoiceengine_unittest.cc
|
| +++ b/webrtc/media/webrtc/webrtcvoiceengine_unittest.cc
|
| @@ -40,6 +40,9 @@
|
| #include "webrtc/media/webrtc/fakewebrtcvoiceengine.h"
|
| #include "webrtc/media/webrtc/webrtcvoiceengine.h"
|
|
|
| +// TODO(nisse): Improper include? Move declaration of MediaConfig elsewhere?
|
| +#include "talk/app/webrtc/mediacontroller.h"
|
| +
|
| using cricket::kRtpAudioLevelHeaderExtension;
|
| using cricket::kRtpAbsoluteSenderTimeHeaderExtension;
|
|
|
| @@ -94,7 +97,8 @@ class WebRtcVoiceEngineTestFake : public testing::Test {
|
| if (!engine_.Init(rtc::Thread::Current())) {
|
| return false;
|
| }
|
| - channel_ = engine_.CreateChannel(&call_, cricket::AudioOptions());
|
| + channel_ = engine_.CreateChannel(
|
| + &call_, webrtc::MediaConfig(), cricket::AudioOptions());
|
| return (channel_ != nullptr);
|
| }
|
| bool SetupEngineWithRecvStream() {
|
| @@ -154,7 +158,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_, webrtc::MediaConfig(), cricket::AudioOptions());
|
| EXPECT_TRUE(channel_ != nullptr);
|
| if (caller) {
|
| // If this is a caller, local description will be applied and add the
|
| @@ -431,7 +436,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_,
|
| + webrtc::MediaConfig(), cricket::AudioOptions());
|
| EXPECT_TRUE(channel_ != nullptr);
|
| }
|
|
|
| @@ -1718,7 +1724,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_,
|
| + webrtc::MediaConfig(), cricket::AudioOptions());
|
| EXPECT_TRUE(channel_ != nullptr);
|
|
|
| cricket::AudioSendParameters parameters;
|
| @@ -1835,7 +1842,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_,
|
| + webrtc::MediaConfig(), cricket::AudioOptions());
|
| EXPECT_TRUE(channel_ != nullptr);
|
|
|
| cricket::AudioSendParameters parameters;
|
| @@ -2366,7 +2374,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_,
|
| + webrtc::MediaConfig(), cricket::AudioOptions());
|
|
|
| EXPECT_TRUE(channel_->AddRecvStream(cricket::StreamParams::CreateLegacy(1)));
|
| int receive_channel_num = voe_.GetLastChannel();
|
| @@ -2795,10 +2804,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_,
|
| + webrtc::MediaConfig(), cricket::AudioOptions())));
|
| rtc::scoped_ptr<cricket::WebRtcVoiceMediaChannel> channel2(
|
| static_cast<cricket::WebRtcVoiceMediaChannel*>(
|
| - engine_.CreateChannel(&call_, cricket::AudioOptions())));
|
| + engine_.CreateChannel(&call_,
|
| + webrtc::MediaConfig(), cricket::AudioOptions())));
|
|
|
| // Have to add a stream to make SetSend work.
|
| cricket::StreamParams stream1;
|
| @@ -2892,23 +2903,21 @@ TEST_F(WebRtcVoiceEngineTestFake, SetOptionOverridesViaChannels) {
|
| }
|
|
|
| // This test verifies DSCP settings are properly applied on voice media channel.
|
| +
|
| +// TODO(nisse): Recreate channel with different settings, like for
|
| +// WebRtcVideoChannel2Test.TestSetDscpOptions
|
| TEST_F(WebRtcVoiceEngineTestFake, TestSetDscpOptions) {
|
| EXPECT_TRUE(SetupEngineWithSendStream());
|
| + webrtc::MediaConfig config;
|
| + config.enable_dscp = true;
|
| rtc::scoped_ptr<cricket::VoiceMediaChannel> channel(
|
| - engine_.CreateChannel(&call_, cricket::AudioOptions()));
|
| + engine_.CreateChannel(&call_,
|
| + config,
|
| + 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());
|
| }
|
|
|
| TEST_F(WebRtcVoiceEngineTestFake, TestGetReceiveChannelId) {
|
| @@ -3167,7 +3176,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(),
|
| + webrtc::MediaConfig(), cricket::AudioOptions());
|
| EXPECT_TRUE(channel != nullptr);
|
| delete channel;
|
| engine.Terminate();
|
| @@ -3273,7 +3283,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(),
|
| + webrtc::MediaConfig(), cricket::AudioOptions());
|
| if (!channel)
|
| break;
|
| channels[num_channels++] = channel;
|
| @@ -3294,7 +3305,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,
|
| + webrtc::MediaConfig(),
|
| + cricket::AudioOptions(),
|
| call.get());
|
| cricket::AudioRecvParameters parameters;
|
| parameters.codecs = engine.codecs();
|
|
|