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 | #ifndef MODULES_AUDIO_CODING_ACM2_CALL_STATISTICS_H_ |
| 12 | #define MODULES_AUDIO_CODING_ACM2_CALL_STATISTICS_H_ |
wu@webrtc.org | 24301a6 | 2013-12-13 19:17:43 +0000 | [diff] [blame] | 13 | |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame^] | 14 | #include "common_types.h" |
| 15 | #include "modules/include/module_common_types.h" |
wu@webrtc.org | 24301a6 | 2013-12-13 19:17:43 +0000 | [diff] [blame] | 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: |
| 36 | CallStatistics() {} |
| 37 | ~CallStatistics() {} |
| 38 | |
| 39 | // Call this method to indicate that NetEq engaged in decoding. |speech_type| |
henrik.lundin | 6348978 | 2016-09-20 01:47:12 -0700 | [diff] [blame] | 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); |
wu@webrtc.org | 24301a6 | 2013-12-13 19:17:43 +0000 | [diff] [blame] | 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 | |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame^] | 64 | #endif // MODULES_AUDIO_CODING_ACM2_CALL_STATISTICS_H_ |