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 | |
Henrik Kjellander | ff761fb | 2015-11-04 08:31:52 +0100 | [diff] [blame] | 14 | #include "webrtc/modules/include/module.h" |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 15 | |
| 16 | namespace webrtc { |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 17 | namespace voe { |
| 18 | |
tommi | b1175bb | 2017-02-28 01:16:48 -0800 | [diff] [blame] | 19 | // When associated with a ProcessThread, calls a callback method |
| 20 | // |OnPeriodicProcess()| implemented by the |Observer|. |
| 21 | // TODO(tommi): This could be replaced with PostDelayedTask(). |
| 22 | // Better yet, delete it and delete code related to |_saturationWarning| |
| 23 | // in TransmitMixer (and the OnPeriodicProcess callback). |
| 24 | template <typename Observer> |
| 25 | class MonitorModule : public Module { |
| 26 | public: |
| 27 | explicit MonitorModule(Observer* observer) : observer_(observer) {} |
| 28 | ~MonitorModule() override {} |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 29 | |
tommi | b1175bb | 2017-02-28 01:16:48 -0800 | [diff] [blame] | 30 | private: |
| 31 | int64_t TimeUntilNextProcess() override { return 1000; } |
| 32 | void Process() override { observer_->OnPeriodicProcess(); } |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 33 | |
tommi | b1175bb | 2017-02-28 01:16:48 -0800 | [diff] [blame] | 34 | Observer* const observer_; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 35 | }; |
| 36 | |
pbos@webrtc.org | d900e8b | 2013-07-03 15:12:26 +0000 | [diff] [blame] | 37 | } // namespace voe |
pbos@webrtc.org | d900e8b | 2013-07-03 15:12:26 +0000 | [diff] [blame] | 38 | } // namespace webrtc |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 39 | |
tommi | b1175bb | 2017-02-28 01:16:48 -0800 | [diff] [blame] | 40 | #endif // VOICE_ENGINE_MONITOR_MODULE |