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 | |
kjellander | 3e6db23 | 2015-11-26 04:44:54 -0800 | [diff] [blame] | 11 | #ifndef WEBRTC_MODULES_AUDIO_CODING_ACM2_CALL_STATISTICS_H_ |
| 12 | #define WEBRTC_MODULES_AUDIO_CODING_ACM2_CALL_STATISTICS_H_ |
wu@webrtc.org | 24301a6 | 2013-12-13 19:17:43 +0000 | [diff] [blame] | 13 | |
| 14 | #include "webrtc/common_types.h" |
Henrik Kjellander | ff761fb | 2015-11-04 08:31:52 +0100 | [diff] [blame] | 15 | #include "webrtc/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| |
| 40 | // is the audio-type according to NetEq. |
| 41 | void DecodedByNetEq(AudioFrame::SpeechType speech_type); |
| 42 | |
| 43 | // Call this method to indicate that a decoding call resulted in generating |
| 44 | // silence, i.e. call to NetEq is bypassed and the output audio is zero. |
| 45 | void DecodedBySilenceGenerator(); |
| 46 | |
| 47 | // Get statistics for decoding. The statistics include the number of calls to |
| 48 | // NetEq and silence generator, as well as the type of speech pulled of off |
| 49 | // NetEq, c.f. declaration of AudioDecodingCallStats for detailed description. |
| 50 | const AudioDecodingCallStats& GetDecodingStatistics() const; |
| 51 | |
| 52 | private: |
| 53 | // Reset the decoding statistics. |
| 54 | void ResetDecodingStatistics(); |
| 55 | |
| 56 | AudioDecodingCallStats decoding_stat_; |
| 57 | }; |
| 58 | |
| 59 | } // namespace acm2 |
| 60 | |
| 61 | } // namespace webrtc |
| 62 | |
kjellander | 3e6db23 | 2015-11-26 04:44:54 -0800 | [diff] [blame] | 63 | #endif // WEBRTC_MODULES_AUDIO_CODING_ACM2_CALL_STATISTICS_H_ |