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

Unified Diff: webrtc/modules/audio_coding/codecs/opus/audio_encoder_opus_unittest.cc

Issue 2746333009: OnReceivedUplinkPacketLossFraction() receives [const rtc::Optional<float>&] (Closed)
Patch Set: Rebased Created 3 years, 9 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/modules/audio_coding/codecs/opus/audio_encoder_opus_unittest.cc
diff --git a/webrtc/modules/audio_coding/codecs/opus/audio_encoder_opus_unittest.cc b/webrtc/modules/audio_coding/codecs/opus/audio_encoder_opus_unittest.cc
index 1d4fc2e7813c9c3b2eee1bc6596be2ace20e47f6..502275a238133ba003d8c7b2b04714ead69f5430 100644
--- a/webrtc/modules/audio_coding/codecs/opus/audio_encoder_opus_unittest.cc
+++ b/webrtc/modules/audio_coding/codecs/opus/audio_encoder_opus_unittest.cc
@@ -237,7 +237,8 @@ void TestSetPacketLossRate(AudioEncoderOpusStates* states,
// PacketLossFractionSmoother used in AudioEncoderOpus.
constexpr int64_t kSampleIntervalMs = 184198;
for (float loss : losses) {
- states->encoder->OnReceivedUplinkPacketLossFraction(loss);
+ states->encoder->OnReceivedUplinkPacketLossFraction(
+ rtc::Optional<float>(loss));
states->simulated_clock->AdvanceTimeMilliseconds(kSampleIntervalMs);
EXPECT_FLOAT_EQ(expected_return, states->encoder->packet_loss_rate());
}
@@ -292,10 +293,11 @@ TEST(AudioEncoderOpusTest,
.WillOnce(Return(config));
// Since using mock audio network adaptor, any packet loss fraction is fine.
- constexpr float kUplinkPacketLoss = 0.1f;
+ const auto kUplinkPacketLoss = rtc::Optional<float>(0.1f);
EXPECT_CALL(**states.mock_audio_network_adaptor,
SetUplinkPacketLossFraction(kUplinkPacketLoss));
- states.encoder->OnReceivedUplinkPacketLossFraction(kUplinkPacketLoss);
+ states.encoder->OnReceivedUplinkPacketLossFraction(
+ rtc::Optional<float>(kUplinkPacketLoss));
CheckEncoderRuntimeConfig(states.encoder.get(), config);
}
@@ -360,8 +362,8 @@ TEST(AudioEncoderOpusTest,
// The values are carefully chosen so that if no smoothing is made, the test
// will fail.
- constexpr float kPacketLossFraction_1 = 0.02f;
- constexpr float kPacketLossFraction_2 = 0.198f;
+ const auto kPacketLossFraction_1 = rtc::Optional<float>(0.02f);
+ const auto kPacketLossFraction_2 = rtc::Optional<float>(0.198f);
// |kSecondSampleTimeMs| is chosen to ease the calculation since
// 0.9999 ^ 6931 = 0.5.
constexpr int64_t kSecondSampleTimeMs = 6931;

Powered by Google App Engine
This is Rietveld 408576698