wu@webrtc.org | 24301a6 | 2013-12-13 19:17:43 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. |
| 3 | * |
| 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 |
| 6 | * tree. An additional intellectual property rights grant can be found |
| 7 | * in the file PATENTS. All contributing project authors may |
| 8 | * be found in the AUTHORS file in the root of the source tree. |
| 9 | */ |
| 10 | |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame^] | 11 | #include "modules/audio_coding/acm2/call_statistics.h" |
| 12 | #include "test/gtest.h" |
wu@webrtc.org | 24301a6 | 2013-12-13 19:17:43 +0000 | [diff] [blame] | 13 | |
| 14 | namespace webrtc { |
| 15 | |
| 16 | namespace acm2 { |
| 17 | |
| 18 | TEST(CallStatisticsTest, InitializedZero) { |
| 19 | CallStatistics call_stats; |
| 20 | AudioDecodingCallStats stats; |
| 21 | |
| 22 | stats = call_stats.GetDecodingStatistics(); |
| 23 | EXPECT_EQ(0, stats.calls_to_neteq); |
| 24 | EXPECT_EQ(0, stats.calls_to_silence_generator); |
| 25 | EXPECT_EQ(0, stats.decoded_normal); |
| 26 | EXPECT_EQ(0, stats.decoded_cng); |
| 27 | EXPECT_EQ(0, stats.decoded_plc); |
| 28 | EXPECT_EQ(0, stats.decoded_plc_cng); |
henrik.lundin | 6348978 | 2016-09-20 01:47:12 -0700 | [diff] [blame] | 29 | EXPECT_EQ(0, stats.decoded_muted_output); |
wu@webrtc.org | 24301a6 | 2013-12-13 19:17:43 +0000 | [diff] [blame] | 30 | } |
| 31 | |
| 32 | TEST(CallStatisticsTest, AllCalls) { |
| 33 | CallStatistics call_stats; |
| 34 | AudioDecodingCallStats stats; |
| 35 | |
| 36 | call_stats.DecodedBySilenceGenerator(); |
henrik.lundin | 6348978 | 2016-09-20 01:47:12 -0700 | [diff] [blame] | 37 | call_stats.DecodedByNetEq(AudioFrame::kNormalSpeech, false); |
| 38 | call_stats.DecodedByNetEq(AudioFrame::kPLC, false); |
| 39 | call_stats.DecodedByNetEq(AudioFrame::kPLCCNG, true); // Let this be muted. |
| 40 | call_stats.DecodedByNetEq(AudioFrame::kCNG, false); |
wu@webrtc.org | 24301a6 | 2013-12-13 19:17:43 +0000 | [diff] [blame] | 41 | |
| 42 | stats = call_stats.GetDecodingStatistics(); |
| 43 | EXPECT_EQ(4, stats.calls_to_neteq); |
| 44 | EXPECT_EQ(1, stats.calls_to_silence_generator); |
| 45 | EXPECT_EQ(1, stats.decoded_normal); |
| 46 | EXPECT_EQ(1, stats.decoded_cng); |
| 47 | EXPECT_EQ(1, stats.decoded_plc); |
| 48 | EXPECT_EQ(1, stats.decoded_plc_cng); |
henrik.lundin | 6348978 | 2016-09-20 01:47:12 -0700 | [diff] [blame] | 49 | EXPECT_EQ(1, stats.decoded_muted_output); |
wu@webrtc.org | 24301a6 | 2013-12-13 19:17:43 +0000 | [diff] [blame] | 50 | } |
| 51 | |
| 52 | } // namespace acm2 |
| 53 | |
| 54 | } // namespace webrtc |
| 55 | |
| 56 | |
| 57 | |