blob: ebe4acaa97685c9e69e0c07505e0c606a383aca0 [file] [log] [blame]
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +00001/*
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
pbos@webrtc.org471ae722013-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"
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +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.org54f03bc2013-04-09 10:09:10 +000035 int32_t RegisterObserver(MonitorObserver& observer);
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +000036
pbos@webrtc.org54f03bc2013-04-09 10:09:10 +000037 int32_t DeRegisterObserver();
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +000038
39 MonitorModule();
40
41 virtual ~MonitorModule();
42public: // module
pbos@webrtc.org54f03bc2013-04-09 10:09:10 +000043 int32_t Version(char* version,
44 uint32_t& remainingBufferInBytes,
45 uint32_t& position) const;
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +000046
pbos@webrtc.orgca7a9a22013-05-14 08:31:39 +000047 int32_t ChangeUniqueId(int32_t id);
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +000048
pbos@webrtc.org54f03bc2013-04-09 10:09:10 +000049 int32_t TimeUntilNextProcess();
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +000050
pbos@webrtc.org54f03bc2013-04-09 10:09:10 +000051 int32_t Process();
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +000052private:
53 enum { kAverageProcessUpdateTimeMs = 1000 };
54 MonitorObserver* _observerPtr;
55 CriticalSectionWrapper& _callbackCritSect;
pbos@webrtc.org54f03bc2013-04-09 10:09:10 +000056 int32_t _lastProcessTime;
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +000057};
58
pbos@webrtc.org3b89e102013-07-03 15:12:26 +000059} // namespace voe
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +000060
pbos@webrtc.org3b89e102013-07-03 15:12:26 +000061} // namespace webrtc
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +000062
63#endif // VOICE_ENGINE_MONITOR_MODULE