niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 1 | /* |
leozwang@webrtc.org | 813e4b0 | 2012-03-01 18:34:25 +0000 | [diff] [blame] | 2 | * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 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 WEBRTC_VOICE_ENGINE_MONITOR_MODULE_H |
| 12 | #define WEBRTC_VOICE_ENGINE_MONITOR_MODULE_H |
| 13 | |
pbos@webrtc.org | 956aa7e | 2013-05-21 13:52:32 +0000 | [diff] [blame] | 14 | #include "webrtc/modules/interface/module.h" |
| 15 | #include "webrtc/typedefs.h" |
| 16 | #include "webrtc/voice_engine/voice_engine_defines.h" |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 17 | |
| 18 | class MonitorObserver |
| 19 | { |
| 20 | public: |
| 21 | virtual void OnPeriodicProcess() = 0; |
| 22 | protected: |
| 23 | virtual ~MonitorObserver() {} |
| 24 | }; |
| 25 | |
| 26 | |
| 27 | namespace webrtc { |
| 28 | class CriticalSectionWrapper; |
| 29 | |
| 30 | namespace voe { |
| 31 | |
| 32 | class MonitorModule : public Module |
| 33 | { |
| 34 | public: |
pbos@webrtc.org | 6141e13 | 2013-04-09 10:09:10 +0000 | [diff] [blame] | 35 | int32_t RegisterObserver(MonitorObserver& observer); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 36 | |
pbos@webrtc.org | 6141e13 | 2013-04-09 10:09:10 +0000 | [diff] [blame] | 37 | int32_t DeRegisterObserver(); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 38 | |
| 39 | MonitorModule(); |
| 40 | |
| 41 | virtual ~MonitorModule(); |
| 42 | public: // module |
henrik.lundin@webrtc.org | 1972ff8 | 2014-09-11 06:20:28 +0000 | [diff] [blame] | 43 | virtual int32_t ChangeUniqueId(int32_t id) OVERRIDE; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 44 | |
henrik.lundin@webrtc.org | 1972ff8 | 2014-09-11 06:20:28 +0000 | [diff] [blame] | 45 | virtual int32_t TimeUntilNextProcess() OVERRIDE; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 46 | |
henrik.lundin@webrtc.org | 1972ff8 | 2014-09-11 06:20:28 +0000 | [diff] [blame] | 47 | virtual int32_t Process() OVERRIDE; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 48 | private: |
| 49 | enum { kAverageProcessUpdateTimeMs = 1000 }; |
| 50 | MonitorObserver* _observerPtr; |
| 51 | CriticalSectionWrapper& _callbackCritSect; |
pbos@webrtc.org | 6141e13 | 2013-04-09 10:09:10 +0000 | [diff] [blame] | 52 | int32_t _lastProcessTime; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 53 | }; |
| 54 | |
pbos@webrtc.org | d900e8b | 2013-07-03 15:12:26 +0000 | [diff] [blame] | 55 | } // namespace voe |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 56 | |
pbos@webrtc.org | d900e8b | 2013-07-03 15:12:26 +0000 | [diff] [blame] | 57 | } // namespace webrtc |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 58 | |
| 59 | #endif // VOICE_ENGINE_MONITOR_MODULE |