tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

call_statistics_unittest.cc (1950B)


      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 
     11 #include "modules/audio_coding/acm2/call_statistics.h"
     12 
     13 #include "api/audio/audio_frame.h"
     14 #include "modules/audio_coding/include/audio_coding_module_typedefs.h"
     15 #include "test/gtest.h"
     16 
     17 namespace webrtc {
     18 
     19 namespace acm2 {
     20 
     21 TEST(CallStatisticsTest, InitializedZero) {
     22  CallStatistics call_stats;
     23  AudioDecodingCallStats stats;
     24 
     25  stats = call_stats.GetDecodingStatistics();
     26  EXPECT_EQ(0, stats.calls_to_neteq);
     27  EXPECT_EQ(0, stats.calls_to_silence_generator);
     28  EXPECT_EQ(0, stats.decoded_normal);
     29  EXPECT_EQ(0, stats.decoded_cng);
     30  EXPECT_EQ(0, stats.decoded_neteq_plc);
     31  EXPECT_EQ(0, stats.decoded_plc_cng);
     32  EXPECT_EQ(0, stats.decoded_muted_output);
     33 }
     34 
     35 TEST(CallStatisticsTest, AllCalls) {
     36  CallStatistics call_stats;
     37  AudioDecodingCallStats stats;
     38 
     39  call_stats.DecodedBySilenceGenerator();
     40  call_stats.DecodedByNetEq(AudioFrame::kNormalSpeech, false);
     41  call_stats.DecodedByNetEq(AudioFrame::kPLC, false);
     42  call_stats.DecodedByNetEq(AudioFrame::kCodecPLC, false);
     43  call_stats.DecodedByNetEq(AudioFrame::kPLCCNG, true);  // Let this be muted.
     44  call_stats.DecodedByNetEq(AudioFrame::kCNG, false);
     45 
     46  stats = call_stats.GetDecodingStatistics();
     47  EXPECT_EQ(5, stats.calls_to_neteq);
     48  EXPECT_EQ(1, stats.calls_to_silence_generator);
     49  EXPECT_EQ(1, stats.decoded_normal);
     50  EXPECT_EQ(1, stats.decoded_cng);
     51  EXPECT_EQ(1, stats.decoded_neteq_plc);
     52  EXPECT_EQ(1, stats.decoded_codec_plc);
     53  EXPECT_EQ(1, stats.decoded_plc_cng);
     54  EXPECT_EQ(1, stats.decoded_muted_output);
     55 }
     56 
     57 }  // namespace acm2
     58 
     59 }  // namespace webrtc