Index: webrtc/media/engine/webrtcvoiceengine_unittest.cc |
diff --git a/webrtc/media/engine/webrtcvoiceengine_unittest.cc b/webrtc/media/engine/webrtcvoiceengine_unittest.cc |
index 30be07d21398f97572f453ed08bb930c805f5986..a4fdcf242cefd3afe2971725821e6e98a75e6553 100644 |
--- a/webrtc/media/engine/webrtcvoiceengine_unittest.cc |
+++ b/webrtc/media/engine/webrtcvoiceengine_unittest.cc |
@@ -189,12 +189,12 @@ class WebRtcVoiceEngineTestFake : public testing::Test { |
// |expected_result| is the expected result from SetMaxSendBandwidth(). |
// |expected_bitrate| is the expected audio bitrate afterward. |
void TestSendBandwidth(const cricket::AudioCodec& codec, |
- int max_bitrate, |
+ rtc::Optional<int> max_bitrate, |
bool expected_result, |
int expected_bitrate) { |
cricket::AudioSendParameters parameters; |
parameters.codecs.push_back(codec); |
- parameters.max_bandwidth_bps = max_bitrate; |
+ parameters.max_bitrate_bps = max_bitrate; |
EXPECT_EQ(expected_result, channel_->SetSendParameters(parameters)); |
int channel_num = voe_.GetLastChannel(); |
@@ -693,13 +693,13 @@ TEST_F(WebRtcVoiceEngineTestFake, SetSendBandwidthAuto) { |
// bitrate is <= 0. |
// ISAC, default bitrate == 32000. |
- TestSendBandwidth(kIsacCodec, 0, true, 32000); |
+ TestSendBandwidth(kIsacCodec, rtc::Optional<int>(), true, 32000); |
// PCMU, default bitrate == 64000. |
- TestSendBandwidth(kPcmuCodec, -1, true, 64000); |
+ TestSendBandwidth(kPcmuCodec, rtc::Optional<int>(), true, 64000); |
// opus, default bitrate == 64000. |
- TestSendBandwidth(kOpusCodec, -1, true, 64000); |
+ TestSendBandwidth(kOpusCodec, rtc::Optional<int>(), true, 64000); |
} |
TEST_F(WebRtcVoiceEngineTestFake, SetMaxSendBandwidthMultiRateAsCaller) { |
@@ -708,12 +708,12 @@ TEST_F(WebRtcVoiceEngineTestFake, SetMaxSendBandwidthMultiRateAsCaller) { |
// Test that the bitrate of a multi-rate codec is always the maximum. |
// ISAC, default bitrate == 32000. |
- TestSendBandwidth(kIsacCodec, 128000, true, 128000); |
- TestSendBandwidth(kIsacCodec, 16000, true, 16000); |
+ TestSendBandwidth(kIsacCodec, rtc::Optional<int>(128000), true, 128000); |
+ TestSendBandwidth(kIsacCodec, rtc::Optional<int>(16000), true, 16000); |
// opus, default bitrate == 64000. |
- TestSendBandwidth(kOpusCodec, 96000, true, 96000); |
- TestSendBandwidth(kOpusCodec, 48000, true, 48000); |
+ TestSendBandwidth(kOpusCodec, rtc::Optional<int>(96000), true, 96000); |
+ TestSendBandwidth(kOpusCodec, rtc::Optional<int>(48000), true, 48000); |
} |
TEST_F(WebRtcVoiceEngineTestFake, SetMaxSendBandwidthFixedRateAsCaller) { |
@@ -723,13 +723,13 @@ TEST_F(WebRtcVoiceEngineTestFake, SetMaxSendBandwidthFixedRateAsCaller) { |
// if it's bigger than the fixed rate. |
// PCMU, fixed bitrate == 64000. |
- TestSendBandwidth(kPcmuCodec, 0, true, 64000); |
- TestSendBandwidth(kPcmuCodec, 1, false, 64000); |
- TestSendBandwidth(kPcmuCodec, 128000, true, 64000); |
- TestSendBandwidth(kPcmuCodec, 32000, false, 64000); |
- TestSendBandwidth(kPcmuCodec, 64000, true, 64000); |
- TestSendBandwidth(kPcmuCodec, 63999, false, 64000); |
- TestSendBandwidth(kPcmuCodec, 64001, true, 64000); |
+ TestSendBandwidth(kPcmuCodec, rtc::Optional<int>(), true, 64000); |
+ TestSendBandwidth(kPcmuCodec, rtc::Optional<int>(1), false, 64000); |
+ TestSendBandwidth(kPcmuCodec, rtc::Optional<int>(128000), true, 64000); |
+ TestSendBandwidth(kPcmuCodec, rtc::Optional<int>(32000), false, 64000); |
+ TestSendBandwidth(kPcmuCodec, rtc::Optional<int>(64000), true, 64000); |
+ TestSendBandwidth(kPcmuCodec, rtc::Optional<int>(63999), false, 64000); |
+ TestSendBandwidth(kPcmuCodec, rtc::Optional<int>(64001), true, 64000); |
} |
TEST_F(WebRtcVoiceEngineTestFake, SetMaxSendBandwidthMultiRateAsCallee) { |
@@ -737,7 +737,7 @@ TEST_F(WebRtcVoiceEngineTestFake, SetMaxSendBandwidthMultiRateAsCallee) { |
const int kDesiredBitrate = 128000; |
cricket::AudioSendParameters parameters; |
parameters.codecs = engine_.codecs(); |
- parameters.max_bandwidth_bps = kDesiredBitrate; |
+ parameters.max_bitrate_bps = rtc::Optional<int>(kDesiredBitrate); |
EXPECT_TRUE(channel_->SetSendParameters(parameters)); |
EXPECT_TRUE(channel_->AddSendStream( |
@@ -762,12 +762,12 @@ TEST_F(WebRtcVoiceEngineTestFake, SetMaxSendBandwidthCbr) { |
EXPECT_EQ(0, voe_.GetSendCodec(channel_num, codec)); |
EXPECT_EQ(64000, codec.rate); |
- send_parameters_.max_bandwidth_bps = 128000; |
+ send_parameters_.max_bitrate_bps = rtc::Optional<int>(128000); |
EXPECT_TRUE(channel_->SetSendParameters(send_parameters_)); |
EXPECT_EQ(0, voe_.GetSendCodec(channel_num, codec)); |
EXPECT_EQ(64000, codec.rate); |
- send_parameters_.max_bandwidth_bps = 128; |
+ send_parameters_.max_bitrate_bps = rtc::Optional<int>(128); |
EXPECT_FALSE(channel_->SetSendParameters(send_parameters_)); |
EXPECT_EQ(0, voe_.GetSendCodec(channel_num, codec)); |
EXPECT_EQ(64000, codec.rate); |