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

Unified Diff: webrtc/modules/audio_coding/audio_network_adaptor/audio_network_adaptor_impl_unittest.cc

Issue 2661043003: Allow ANA to receive RPLR (recoverable packet loss rate) indications (Closed)
Patch Set: Uncomment thread-checker to fix UT 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/audio_network_adaptor/audio_network_adaptor_impl_unittest.cc
diff --git a/webrtc/modules/audio_coding/audio_network_adaptor/audio_network_adaptor_impl_unittest.cc b/webrtc/modules/audio_coding/audio_network_adaptor/audio_network_adaptor_impl_unittest.cc
index db2a466c436fdafcfceaf82fda47a9b517b41f3b..c434be35f52b56961ddf0c3409fb28698d2a5090 100644
--- a/webrtc/modules/audio_coding/audio_network_adaptor/audio_network_adaptor_impl_unittest.cc
+++ b/webrtc/modules/audio_coding/audio_network_adaptor/audio_network_adaptor_impl_unittest.cc
@@ -36,7 +36,10 @@ MATCHER_P(NetworkMetricsIs, metric, "") {
arg.target_audio_bitrate_bps == metric.target_audio_bitrate_bps &&
arg.rtt_ms == metric.rtt_ms &&
arg.overhead_bytes_per_packet == metric.overhead_bytes_per_packet &&
- arg.uplink_packet_loss_fraction == metric.uplink_packet_loss_fraction;
+ arg.uplink_packet_loss_fraction ==
+ metric.uplink_packet_loss_fraction &&
+ arg.uplink_recoverable_packet_loss_fraction ==
+ metric.uplink_recoverable_packet_loss_fraction;
}
MATCHER_P(EncoderRuntimeConfigIs, config, "") {
@@ -127,6 +130,18 @@ TEST(AudioNetworkAdaptorImplTest,
states.audio_network_adaptor->SetUplinkPacketLossFraction(kPacketLoss);
}
+TEST(AudioNetworkAdaptorImplTest,
+ UpdateNetworkMetricsIsCalledOnSetUplinkRecoverablePacketLossFraction) {
+ auto states = CreateAudioNetworkAdaptor();
+ constexpr float kRecoverablePacketLoss = 0.1f;
+ Controller::NetworkMetrics check;
+ check.uplink_recoverable_packet_loss_fraction =
+ rtc::Optional<float>(kRecoverablePacketLoss);
+ SetExpectCallToUpdateNetworkMetrics(states.mock_controllers, check);
+ states.audio_network_adaptor->SetUplinkRecoverablePacketLossFraction(
+ kRecoverablePacketLoss);
+}
+
TEST(AudioNetworkAdaptorImplTest, UpdateNetworkMetricsIsCalledOnSetRtt) {
auto states = CreateAudioNetworkAdaptor();
constexpr int kRtt = 100;
@@ -186,6 +201,7 @@ TEST(AudioNetworkAdaptorImplTest,
constexpr int kBandwidth = 16000;
constexpr float kPacketLoss = 0.7f;
+ const auto kRecoverablePacketLoss = 0.2f;
constexpr int kRtt = 100;
constexpr int kTargetAudioBitrate = 15000;
constexpr size_t kOverhead = 64;
@@ -205,6 +221,15 @@ TEST(AudioNetworkAdaptorImplTest,
DumpNetworkMetrics(NetworkMetricsIs(check), timestamp_check));
states.audio_network_adaptor->SetUplinkPacketLossFraction(kPacketLoss);
+ states.simulated_clock->AdvanceTimeMilliseconds(50);
+ timestamp_check += 50;
+ check.uplink_recoverable_packet_loss_fraction =
+ rtc::Optional<float>(kRecoverablePacketLoss);
+ EXPECT_CALL(*states.mock_debug_dump_writer,
+ DumpNetworkMetrics(NetworkMetricsIs(check), timestamp_check));
+ states.audio_network_adaptor->SetUplinkRecoverablePacketLossFraction(
+ kRecoverablePacketLoss);
+
states.simulated_clock->AdvanceTimeMilliseconds(200);
timestamp_check += 200;
check.rtt_ms = rtc::Optional<int>(kRtt);

Powered by Google App Engine
This is Rietveld 408576698