tor-browser

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

call_statistics.cc (1749B)


      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 "rtc_base/checks.h"
     16 
     17 namespace webrtc {
     18 
     19 namespace acm2 {
     20 
     21 void CallStatistics::DecodedByNetEq(AudioFrame::SpeechType speech_type,
     22                                    bool muted) {
     23  ++decoding_stat_.calls_to_neteq;
     24  if (muted) {
     25    ++decoding_stat_.decoded_muted_output;
     26  }
     27  switch (speech_type) {
     28    case AudioFrame::kNormalSpeech: {
     29      ++decoding_stat_.decoded_normal;
     30      break;
     31    }
     32    case AudioFrame::kPLC: {
     33      ++decoding_stat_.decoded_neteq_plc;
     34      break;
     35    }
     36    case AudioFrame::kCodecPLC: {
     37      ++decoding_stat_.decoded_codec_plc;
     38      break;
     39    }
     40    case AudioFrame::kCNG: {
     41      ++decoding_stat_.decoded_cng;
     42      break;
     43    }
     44    case AudioFrame::kPLCCNG: {
     45      ++decoding_stat_.decoded_plc_cng;
     46      break;
     47    }
     48    case AudioFrame::kUndefined: {
     49      // If the audio is decoded by NetEq, `kUndefined` is not an option.
     50      RTC_DCHECK_NOTREACHED();
     51    }
     52  }
     53 }
     54 
     55 void CallStatistics::DecodedBySilenceGenerator() {
     56  ++decoding_stat_.calls_to_silence_generator;
     57 }
     58 
     59 const AudioDecodingCallStats& CallStatistics::GetDecodingStatistics() const {
     60  return decoding_stat_;
     61 }
     62 
     63 }  // namespace acm2
     64 
     65 }  // namespace webrtc