2011-07-07 08:21:25 +00:00
|
|
|
/*
|
2012-01-30 09:39:08 +00:00
|
|
|
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
|
2011-07-07 08:21:25 +00:00
|
|
|
*
|
|
|
|
|
* Use of this source code is governed by a BSD-style license
|
|
|
|
|
* that can be found in the LICENSE file in the root of the source
|
|
|
|
|
* tree. An additional intellectual property rights grant can be found
|
|
|
|
|
* in the file PATENTS. All contributing project authors may
|
|
|
|
|
* be found in the AUTHORS file in the root of the source tree.
|
|
|
|
|
*/
|
|
|
|
|
|
2012-01-30 09:39:08 +00:00
|
|
|
#ifndef WEBRTC_MODULES_AUDIO_PROCESSING_LEVEL_ESTIMATOR_IMPL_H_
|
|
|
|
|
#define WEBRTC_MODULES_AUDIO_PROCESSING_LEVEL_ESTIMATOR_IMPL_H_
|
2011-07-07 08:21:25 +00:00
|
|
|
|
2016-02-19 07:04:49 -08:00
|
|
|
#include <memory>
|
|
|
|
|
|
2015-12-15 11:39:38 -08:00
|
|
|
#include "webrtc/base/constructormagic.h"
|
2015-11-28 12:35:15 -08:00
|
|
|
#include "webrtc/base/criticalsection.h"
|
2013-05-28 08:11:59 +00:00
|
|
|
#include "webrtc/modules/audio_processing/include/audio_processing.h"
|
2011-07-07 08:21:25 +00:00
|
|
|
|
|
|
|
|
namespace webrtc {
|
2014-02-27 22:23:17 +00:00
|
|
|
|
2011-07-07 08:21:25 +00:00
|
|
|
class AudioBuffer;
|
2015-12-15 11:39:38 -08:00
|
|
|
class RMSLevel;
|
2011-07-07 08:21:25 +00:00
|
|
|
|
2015-12-15 11:39:38 -08:00
|
|
|
class LevelEstimatorImpl : public LevelEstimator {
|
2011-07-07 08:21:25 +00:00
|
|
|
public:
|
2015-12-15 11:39:38 -08:00
|
|
|
explicit LevelEstimatorImpl(rtc::CriticalSection* crit);
|
|
|
|
|
~LevelEstimatorImpl() override;
|
2011-07-07 08:21:25 +00:00
|
|
|
|
2015-12-15 11:39:38 -08:00
|
|
|
// TODO(peah): Fold into ctor, once public API is removed.
|
|
|
|
|
void Initialize();
|
|
|
|
|
void ProcessStream(AudioBuffer* audio);
|
2011-07-07 08:21:25 +00:00
|
|
|
|
|
|
|
|
// LevelEstimator implementation.
|
2015-03-04 12:58:35 +00:00
|
|
|
int Enable(bool enable) override;
|
2015-12-15 11:39:38 -08:00
|
|
|
bool is_enabled() const override;
|
2015-03-04 12:58:35 +00:00
|
|
|
int RMS() override;
|
2011-07-07 08:21:25 +00:00
|
|
|
|
2015-12-15 11:39:38 -08:00
|
|
|
private:
|
|
|
|
|
rtc::CriticalSection* const crit_ = nullptr;
|
|
|
|
|
bool enabled_ GUARDED_BY(crit_) = false;
|
2016-02-19 07:04:49 -08:00
|
|
|
std::unique_ptr<RMSLevel> rms_ GUARDED_BY(crit_);
|
2015-12-15 11:39:38 -08:00
|
|
|
RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(LevelEstimatorImpl);
|
2011-07-07 08:21:25 +00:00
|
|
|
};
|
|
|
|
|
} // namespace webrtc
|
|
|
|
|
|
2012-01-30 09:39:08 +00:00
|
|
|
#endif // WEBRTC_MODULES_AUDIO_PROCESSING_LEVEL_ESTIMATOR_IMPL_H_
|