blob: 3993319e89a998fe5f7246152bb1a7829dd1b22e [file] [log] [blame]
wu@webrtc.org24301a62013-12-13 19:17:43 +00001/*
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
kjellander3e6db232015-11-26 04:44:54 -080011#ifndef WEBRTC_MODULES_AUDIO_CODING_ACM2_CALL_STATISTICS_H_
12#define WEBRTC_MODULES_AUDIO_CODING_ACM2_CALL_STATISTICS_H_
wu@webrtc.org24301a62013-12-13 19:17:43 +000013
14#include "webrtc/common_types.h"
Henrik Kjellanderff761fb2015-11-04 08:31:52 +010015#include "webrtc/modules/include/module_common_types.h"
wu@webrtc.org24301a62013-12-13 19:17:43 +000016
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
30namespace webrtc {
31
32namespace acm2 {
33
34class CallStatistics {
35 public:
36 CallStatistics() {}
37 ~CallStatistics() {}
38
39 // Call this method to indicate that NetEq engaged in decoding. |speech_type|
henrik.lundin63489782016-09-20 01:47:12 -070040 // 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.org24301a62013-12-13 19:17:43 +000043
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
kjellander3e6db232015-11-26 04:44:54 -080064#endif // WEBRTC_MODULES_AUDIO_CODING_ACM2_CALL_STATISTICS_H_