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

Side by Side Diff: webrtc/modules/audio_coding/audio_network_adaptor/audio_network_adaptor_impl_unittest.cc

Issue 3011623002: Add new ANA stats to GetStats() to count the number of actions taken by each controller. (Closed)
Patch Set: Fix for failing test. Created 3 years, 3 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 263
264 EXPECT_CALL(*states.mock_controllers[0], MakeDecision(_)) 264 EXPECT_CALL(*states.mock_controllers[0], MakeDecision(_))
265 .WillOnce(SetArgPointee<0>(config)); 265 .WillOnce(SetArgPointee<0>(config));
266 266
267 EXPECT_CALL(*states.event_log, 267 EXPECT_CALL(*states.event_log,
268 LogAudioNetworkAdaptation(EncoderRuntimeConfigIs(config))) 268 LogAudioNetworkAdaptation(EncoderRuntimeConfigIs(config)))
269 .Times(1); 269 .Times(1);
270 states.audio_network_adaptor->GetEncoderRuntimeConfig(); 270 states.audio_network_adaptor->GetEncoderRuntimeConfig();
271 } 271 }
272 272
273 TEST(AudioNetworkAdaptorImplTest, TestANAStats) {
274 auto states = CreateAudioNetworkAdaptor();
275
276 // Simulate some adaptation, otherwise the stats will not show anything.
277 AudioEncoderRuntimeConfig config1, config2;
278 config1.bitrate_bps = rtc::Optional<int>(32000);
279 config1.enable_fec = rtc::Optional<bool>(true);
280 config2.bitrate_bps = rtc::Optional<int>(16000);
281 config2.enable_fec = rtc::Optional<bool>(false);
282
283 EXPECT_CALL(*states.mock_controllers[0], MakeDecision(_))
284 .WillOnce(SetArgPointee<0>(config1));
285 states.audio_network_adaptor->GetEncoderRuntimeConfig();
286 EXPECT_CALL(*states.mock_controllers[0], MakeDecision(_))
287 .WillOnce(SetArgPointee<0>(config2));
288 states.audio_network_adaptor->GetEncoderRuntimeConfig();
289
290 auto ana_stats = states.audio_network_adaptor->GetStats();
291
292 // Check that the default stats are returned, as these have not been
293 // implemented yet). Tracking bug: https://crbug.com/8127
294 auto default_stats = ANAStats();
295 EXPECT_EQ(ana_stats.bitrate_action_counter,
296 default_stats.bitrate_action_counter);
297 EXPECT_EQ(ana_stats.channel_action_counter,
298 default_stats.channel_action_counter);
299 EXPECT_EQ(ana_stats.dtx_action_counter, default_stats.dtx_action_counter);
300 EXPECT_EQ(ana_stats.fec_action_counter, default_stats.fec_action_counter);
301 EXPECT_EQ(ana_stats.frame_length_action_counter,
302 default_stats.frame_length_action_counter);
303 }
304
273 } // namespace webrtc 305 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698