andrew@webrtc.org | a7b57da | 2012-10-22 18:19:23 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2012 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 WEBRTC_VOICE_ENGINE_MONITOR_MODULE_H |
| 12 | #define WEBRTC_VOICE_ENGINE_MONITOR_MODULE_H |
| 13 | |
| 14 | #include "module.h" |
| 15 | #include "typedefs.h" |
| 16 | #include "voice_engine_defines.h" |
| 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: |
| 35 | WebRtc_Word32 RegisterObserver(MonitorObserver& observer); |
| 36 | |
| 37 | WebRtc_Word32 DeRegisterObserver(); |
| 38 | |
| 39 | MonitorModule(); |
| 40 | |
| 41 | virtual ~MonitorModule(); |
| 42 | public: // module |
| 43 | WebRtc_Word32 Version(char* version, |
| 44 | WebRtc_UWord32& remainingBufferInBytes, |
| 45 | WebRtc_UWord32& position) const; |
| 46 | |
| 47 | WebRtc_Word32 ChangeUniqueId(const WebRtc_Word32 id); |
| 48 | |
| 49 | WebRtc_Word32 TimeUntilNextProcess(); |
| 50 | |
| 51 | WebRtc_Word32 Process(); |
| 52 | private: |
| 53 | enum { kAverageProcessUpdateTimeMs = 1000 }; |
| 54 | MonitorObserver* _observerPtr; |
| 55 | CriticalSectionWrapper& _callbackCritSect; |
| 56 | WebRtc_Word32 _lastProcessTime; |
| 57 | }; |
| 58 | |
| 59 | } // namespace voe |
| 60 | |
| 61 | } // namespace webrtc |
| 62 | |
| 63 | #endif // VOICE_ENGINE_MONITOR_MODULE |