blob: 693b2e00a9c17391440676197d21cf92ac99048c [file] [log] [blame]
niklase@google.com470e71d2011-07-07 08:21:25 +00001/*
leozwang@webrtc.org813e4b02012-03-01 18:34:25 +00002 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
niklase@google.com470e71d2011-07-07 08:21:25 +00003 *
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.org956aa7e2013-05-21 13:52:32 +000014#include "webrtc/modules/interface/module.h"
15#include "webrtc/typedefs.h"
16#include "webrtc/voice_engine/voice_engine_defines.h"
niklase@google.com470e71d2011-07-07 08:21:25 +000017
18class MonitorObserver
19{
20public:
21 virtual void OnPeriodicProcess() = 0;
22protected:
23 virtual ~MonitorObserver() {}
24};
25
26
27namespace webrtc {
28class CriticalSectionWrapper;
29
30namespace voe {
31
32class MonitorModule : public Module
33{
34public:
pbos@webrtc.org6141e132013-04-09 10:09:10 +000035 int32_t RegisterObserver(MonitorObserver& observer);
niklase@google.com470e71d2011-07-07 08:21:25 +000036
pbos@webrtc.org6141e132013-04-09 10:09:10 +000037 int32_t DeRegisterObserver();
niklase@google.com470e71d2011-07-07 08:21:25 +000038
39 MonitorModule();
40
41 virtual ~MonitorModule();
42public: // module
henrik.lundin@webrtc.org1972ff82014-09-11 06:20:28 +000043 virtual int32_t ChangeUniqueId(int32_t id) OVERRIDE;
niklase@google.com470e71d2011-07-07 08:21:25 +000044
henrik.lundin@webrtc.org1972ff82014-09-11 06:20:28 +000045 virtual int32_t TimeUntilNextProcess() OVERRIDE;
niklase@google.com470e71d2011-07-07 08:21:25 +000046
henrik.lundin@webrtc.org1972ff82014-09-11 06:20:28 +000047 virtual int32_t Process() OVERRIDE;
niklase@google.com470e71d2011-07-07 08:21:25 +000048private:
49 enum { kAverageProcessUpdateTimeMs = 1000 };
50 MonitorObserver* _observerPtr;
51 CriticalSectionWrapper& _callbackCritSect;
pbos@webrtc.org6141e132013-04-09 10:09:10 +000052 int32_t _lastProcessTime;
niklase@google.com470e71d2011-07-07 08:21:25 +000053};
54
pbos@webrtc.orgd900e8b2013-07-03 15:12:26 +000055} // namespace voe
niklase@google.com470e71d2011-07-07 08:21:25 +000056
pbos@webrtc.orgd900e8b2013-07-03 15:12:26 +000057} // namespace webrtc
niklase@google.com470e71d2011-07-07 08:21:25 +000058
59#endif // VOICE_ENGINE_MONITOR_MODULE