blob: f026f725d504379b0972f3556ad0506723c6a195 [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
tommi31fc21f2016-01-21 10:37:37 -080014#include "webrtc/base/criticalsection.h"
15#include "webrtc/base/thread_annotations.h"
Henrik Kjellanderff761fb2015-11-04 08:31:52 +010016#include "webrtc/modules/include/module.h"
pbos@webrtc.org956aa7e2013-05-21 13:52:32 +000017#include "webrtc/typedefs.h"
18#include "webrtc/voice_engine/voice_engine_defines.h"
niklase@google.com470e71d2011-07-07 08:21:25 +000019
20class MonitorObserver
21{
22public:
23 virtual void OnPeriodicProcess() = 0;
24protected:
25 virtual ~MonitorObserver() {}
26};
27
28
29namespace webrtc {
niklase@google.com470e71d2011-07-07 08:21:25 +000030namespace 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
kjellander@webrtc.org14665ff2015-03-04 12:58:35 +000043 int64_t TimeUntilNextProcess() override;
niklase@google.com470e71d2011-07-07 08:21:25 +000044
pbosa26ac922016-02-25 04:50:01 -080045 void Process() override;
kjellander@webrtc.org14665ff2015-03-04 12:58:35 +000046
niklase@google.com470e71d2011-07-07 08:21:25 +000047private:
tommi31fc21f2016-01-21 10:37:37 -080048 rtc::CriticalSection _callbackCritSect;
49 MonitorObserver* _observerPtr GUARDED_BY(_callbackCritSect);
pkasting@chromium.org0b1534c2014-12-15 22:09:40 +000050 int64_t _lastProcessTime;
niklase@google.com470e71d2011-07-07 08:21:25 +000051};
52
pbos@webrtc.orgd900e8b2013-07-03 15:12:26 +000053} // namespace voe
niklase@google.com470e71d2011-07-07 08:21:25 +000054
pbos@webrtc.orgd900e8b2013-07-03 15:12:26 +000055} // namespace webrtc
niklase@google.com470e71d2011-07-07 08:21:25 +000056
57#endif // VOICE_ENGINE_MONITOR_MODULE