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 #ifndef MODULES_AUDIO_CODING_ACM2_CALL_STATISTICS_H_ 12 #define MODULES_AUDIO_CODING_ACM2_CALL_STATISTICS_H_ 13 14 #include "api/audio/audio_frame.h" 15 #include "modules/audio_coding/include/audio_coding_module_typedefs.h" 16 17 // 18 // This class is for book keeping of calls to ACM. It is not useful to log API 19 // calls which are supposed to be called every 10ms, e.g. PlayoutData10Ms(), 20 // however, it is useful to know the number of such calls in a given time 21 // interval. The current implementation covers calls to PlayoutData10Ms() with 22 // detailed accounting of the decoded speech type. 23 // 24 // Thread Safety 25 // ============= 26 // Please note that this class in not thread safe. The class must be protected 27 // if different APIs are called from different threads. 28 // 29 30 namespace webrtc { 31 32 namespace acm2 { 33 34 class CallStatistics { 35 public: CallStatistics()36 CallStatistics() {} ~CallStatistics()37 ~CallStatistics() {} 38 39 // Call this method to indicate that NetEq engaged in decoding. |speech_type| 40 // is the audio-type according to NetEq, and |muted| indicates if the decoded 41 // frame was produced in muted state. 42 void DecodedByNetEq(AudioFrame::SpeechType speech_type, bool muted); 43 44 // Call this method to indicate that a decoding call resulted in generating 45 // silence, i.e. call to NetEq is bypassed and the output audio is zero. 46 void DecodedBySilenceGenerator(); 47 48 // Get statistics for decoding. The statistics include the number of calls to 49 // NetEq and silence generator, as well as the type of speech pulled of off 50 // NetEq, c.f. declaration of AudioDecodingCallStats for detailed description. 51 const AudioDecodingCallStats& GetDecodingStatistics() const; 52 53 private: 54 // Reset the decoding statistics. 55 void ResetDecodingStatistics(); 56 57 AudioDecodingCallStats decoding_stat_; 58 }; 59 60 } // namespace acm2 61 62 } // namespace webrtc 63 64 #endif // MODULES_AUDIO_CODING_ACM2_CALL_STATISTICS_H_ 65