Replace scoped_ptr with unique_ptr in webrtc/modules/audio_processing/

BUG=webrtc:5520

Review URL: https://codereview.webrtc.org/1710483002

Cr-Commit-Position: refs/heads/master@{#11684}
This commit is contained in:
kwiberg
2016-02-19 07:04:49 -08:00
committed by Commit bot
parent df88460372
commit 88788adcfd
28 changed files with 111 additions and 95 deletions

View File

@ -11,7 +11,8 @@
#ifndef WEBRTC_MODULES_AUDIO_PROCESSING_AGC_AGC_H_
#define WEBRTC_MODULES_AUDIO_PROCESSING_AGC_AGC_H_
#include "webrtc/base/scoped_ptr.h"
#include <memory>
#include "webrtc/modules/audio_processing/vad/voice_activity_detector.h"
#include "webrtc/typedefs.h"
@ -48,8 +49,8 @@ class Agc {
private:
double target_level_loudness_;
int target_level_dbfs_;
rtc::scoped_ptr<Histogram> histogram_;
rtc::scoped_ptr<Histogram> inactive_histogram_;
std::unique_ptr<Histogram> histogram_;
std::unique_ptr<Histogram> inactive_histogram_;
VoiceActivityDetector vad_;
};

View File

@ -11,7 +11,9 @@
#ifndef WEBRTC_MODULES_AUDIO_PROCESSING_AGC_AGC_MANAGER_DIRECT_H_
#define WEBRTC_MODULES_AUDIO_PROCESSING_AGC_AGC_MANAGER_DIRECT_H_
#include "webrtc/base/scoped_ptr.h"
#include <memory>
#include "webrtc/base/constructormagic.h"
#include "webrtc/modules/audio_processing/agc/agc.h"
namespace webrtc {
@ -81,7 +83,7 @@ class AgcManagerDirect final {
void UpdateGain();
void UpdateCompressor();
rtc::scoped_ptr<Agc> agc_;
std::unique_ptr<Agc> agc_;
GainControl* gctrl_;
VolumeCallbacks* volume_callbacks_;
@ -97,8 +99,8 @@ class AgcManagerDirect final {
bool startup_;
int startup_min_level_;
rtc::scoped_ptr<DebugFile> file_preproc_;
rtc::scoped_ptr<DebugFile> file_postproc_;
std::unique_ptr<DebugFile> file_preproc_;
std::unique_ptr<DebugFile> file_postproc_;
RTC_DISALLOW_COPY_AND_ASSIGN(AgcManagerDirect);
};

View File

@ -13,7 +13,8 @@
#include <string.h>
#include "webrtc/base/scoped_ptr.h"
#include <memory>
#include "webrtc/typedefs.h"
namespace webrtc {
@ -73,9 +74,9 @@ class Histogram {
int64_t bin_count_q10_[kHistSize];
// Circular buffer for probabilities
rtc::scoped_ptr<int[]> activity_probability_;
std::unique_ptr<int[]> activity_probability_;
// Circular buffer for histogram-indices of probabilities.
rtc::scoped_ptr<int[]> hist_bin_index_;
std::unique_ptr<int[]> hist_bin_index_;
// Current index of circular buffer, where the newest data will be written to,
// therefore, pointing to the oldest data if buffer is full.
int buffer_index_;

View File

@ -14,6 +14,7 @@
#include <stdio.h>
#include <cmath>
#include <memory>
#include "gtest/gtest.h"
#include "webrtc/test/testsupport/fileutils.h"
@ -37,7 +38,7 @@ class HistogramTest : public ::testing::Test {
private:
void TestClean();
rtc::scoped_ptr<Histogram> hist_;
std::unique_ptr<Histogram> hist_;
};
void HistogramTest::TestClean() {

View File

@ -11,7 +11,8 @@
#ifndef WEBRTC_MODULES_AUDIO_PROCESSING_AUDIO_BUFFER_H_
#define WEBRTC_MODULES_AUDIO_PROCESSING_AUDIO_BUFFER_H_
#include "webrtc/base/scoped_ptr.h"
#include <memory>
#include "webrtc/common_audio/channel_buffer.h"
#include "webrtc/modules/audio_processing/include/audio_processing.h"
#include "webrtc/modules/audio_processing/splitting_filter.h"
@ -146,14 +147,14 @@ class AudioBuffer {
AudioFrame::VADActivity activity_;
const float* keyboard_data_;
rtc::scoped_ptr<IFChannelBuffer> data_;
rtc::scoped_ptr<IFChannelBuffer> split_data_;
rtc::scoped_ptr<SplittingFilter> splitting_filter_;
rtc::scoped_ptr<ChannelBuffer<int16_t> > mixed_low_pass_channels_;
rtc::scoped_ptr<ChannelBuffer<int16_t> > low_pass_reference_channels_;
rtc::scoped_ptr<IFChannelBuffer> input_buffer_;
rtc::scoped_ptr<IFChannelBuffer> output_buffer_;
rtc::scoped_ptr<ChannelBuffer<float> > process_buffer_;
std::unique_ptr<IFChannelBuffer> data_;
std::unique_ptr<IFChannelBuffer> split_data_;
std::unique_ptr<SplittingFilter> splitting_filter_;
std::unique_ptr<ChannelBuffer<int16_t> > mixed_low_pass_channels_;
std::unique_ptr<ChannelBuffer<int16_t> > low_pass_reference_channels_;
std::unique_ptr<IFChannelBuffer> input_buffer_;
std::unique_ptr<IFChannelBuffer> output_buffer_;
std::unique_ptr<ChannelBuffer<float> > process_buffer_;
ScopedVector<PushSincResampler> input_resamplers_;
ScopedVector<PushSincResampler> output_resamplers_;
};

View File

@ -90,16 +90,16 @@ struct AudioProcessingImpl::ApmPublicSubmodules {
EchoCancellationImpl* echo_cancellation;
EchoControlMobileImpl* echo_control_mobile;
GainControlImpl* gain_control;
rtc::scoped_ptr<HighPassFilterImpl> high_pass_filter;
rtc::scoped_ptr<LevelEstimatorImpl> level_estimator;
rtc::scoped_ptr<NoiseSuppressionImpl> noise_suppression;
rtc::scoped_ptr<VoiceDetectionImpl> voice_detection;
rtc::scoped_ptr<GainControlForExperimentalAgc>
std::unique_ptr<HighPassFilterImpl> high_pass_filter;
std::unique_ptr<LevelEstimatorImpl> level_estimator;
std::unique_ptr<NoiseSuppressionImpl> noise_suppression;
std::unique_ptr<VoiceDetectionImpl> voice_detection;
std::unique_ptr<GainControlForExperimentalAgc>
gain_control_for_experimental_agc;
// Accessed internally from both render and capture.
rtc::scoped_ptr<TransientSuppressor> transient_suppressor;
rtc::scoped_ptr<IntelligibilityEnhancer> intelligibility_enhancer;
std::unique_ptr<TransientSuppressor> transient_suppressor;
std::unique_ptr<IntelligibilityEnhancer> intelligibility_enhancer;
};
struct AudioProcessingImpl::ApmPrivateSubmodules {
@ -107,8 +107,8 @@ struct AudioProcessingImpl::ApmPrivateSubmodules {
: beamformer(beamformer) {}
// Accessed internally from capture or during initialization
std::list<ProcessingComponent*> component_list;
rtc::scoped_ptr<Beamformer<float>> beamformer;
rtc::scoped_ptr<AgcManagerDirect> agc_manager;
std::unique_ptr<Beamformer<float>> beamformer;
std::unique_ptr<AgcManagerDirect> agc_manager;
};
const int AudioProcessing::kNativeSampleRatesHz[] = {
@ -297,11 +297,11 @@ int AudioProcessingImpl::InitializeLocked() {
formats_.rev_proc_format.num_channels(),
rev_audio_buffer_out_num_frames));
if (rev_conversion_needed()) {
render_.render_converter = AudioConverter::Create(
render_.render_converter = rtc::ScopedToUnique(AudioConverter::Create(
formats_.api_format.reverse_input_stream().num_channels(),
formats_.api_format.reverse_input_stream().num_frames(),
formats_.api_format.reverse_output_stream().num_channels(),
formats_.api_format.reverse_output_stream().num_frames());
formats_.api_format.reverse_output_stream().num_frames()));
} else {
render_.render_converter.reset(nullptr);
}

View File

@ -12,11 +12,11 @@
#define WEBRTC_MODULES_AUDIO_PROCESSING_AUDIO_PROCESSING_IMPL_H_
#include <list>
#include <memory>
#include <string>
#include <vector>
#include "webrtc/base/criticalsection.h"
#include "webrtc/base/scoped_ptr.h"
#include "webrtc/base/thread_annotations.h"
#include "webrtc/modules/audio_processing/audio_buffer.h"
#include "webrtc/modules/audio_processing/include/audio_processing.h"
@ -137,7 +137,7 @@ class AudioProcessingImpl : public AudioProcessing {
// State for the debug dump.
struct ApmDebugDumpThreadState {
ApmDebugDumpThreadState() : event_msg(new audioproc::Event()) {}
rtc::scoped_ptr<audioproc::Event> event_msg; // Protobuf message.
std::unique_ptr<audioproc::Event> event_msg; // Protobuf message.
std::string event_str; // Memory for protobuf serialization.
// Serialized string of last saved APM configuration.
@ -149,7 +149,7 @@ class AudioProcessingImpl : public AudioProcessing {
// Number of bytes that can still be written to the log before the maximum
// size is reached. A value of <= 0 indicates that no limit is used.
int64_t num_bytes_left_for_log_ = -1;
rtc::scoped_ptr<FileWrapper> debug_file;
std::unique_ptr<FileWrapper> debug_file;
ApmDebugDumpThreadState render;
ApmDebugDumpThreadState capture;
};
@ -250,8 +250,8 @@ class AudioProcessingImpl : public AudioProcessing {
rtc::CriticalSection crit_capture_;
// Structs containing the pointers to the submodules.
rtc::scoped_ptr<ApmPublicSubmodules> public_submodules_;
rtc::scoped_ptr<ApmPrivateSubmodules> private_submodules_
std::unique_ptr<ApmPublicSubmodules> public_submodules_;
std::unique_ptr<ApmPrivateSubmodules> private_submodules_
GUARDED_BY(crit_capture_);
// State that is written to while holding both the render and capture locks
@ -313,7 +313,7 @@ class AudioProcessingImpl : public AudioProcessing {
bool transient_suppressor_enabled;
std::vector<Point> array_geometry;
SphericalPointf target_direction;
rtc::scoped_ptr<AudioBuffer> capture_audio;
std::unique_ptr<AudioBuffer> capture_audio;
// Only the rate and samples fields of fwd_proc_format_ are used because the
// forward processing number of channels is mutable and is tracked by the
// capture_audio_.
@ -337,8 +337,8 @@ class AudioProcessingImpl : public AudioProcessing {
} capture_nonlocked_;
struct ApmRenderState {
rtc::scoped_ptr<AudioConverter> render_converter;
rtc::scoped_ptr<AudioBuffer> render_audio;
std::unique_ptr<AudioConverter> render_converter;
std::unique_ptr<AudioBuffer> render_audio;
} render_ GUARDED_BY(crit_render_);
};

View File

@ -11,6 +11,7 @@
#include "webrtc/modules/audio_processing/audio_processing_impl.h"
#include <algorithm>
#include <memory>
#include <vector>
#include "testing/gtest/include/gtest/gtest.h"
@ -447,7 +448,7 @@ class AudioProcessingImplLockTest
rtc::PlatformThread stats_thread_;
mutable RandomGenerator rand_gen_;
rtc::scoped_ptr<AudioProcessing> apm_;
std::unique_ptr<AudioProcessing> apm_;
TestConfig test_config_;
FrameCounters frame_counters_;
RenderProcessor render_thread_state_;

View File

@ -12,6 +12,7 @@
#include <math.h>
#include <algorithm>
#include <memory>
#include <vector>
#include "testing/gtest/include/gtest/gtest.h"
@ -657,19 +658,19 @@ class CallSimulator : public ::testing::TestWithParam<SimulationConfig> {
}
// Event handler for the test.
const rtc::scoped_ptr<EventWrapper> test_complete_;
const std::unique_ptr<EventWrapper> test_complete_;
// Thread related variables.
rtc::scoped_ptr<rtc::PlatformThread> render_thread_;
rtc::scoped_ptr<rtc::PlatformThread> capture_thread_;
std::unique_ptr<rtc::PlatformThread> render_thread_;
std::unique_ptr<rtc::PlatformThread> capture_thread_;
Random rand_gen_;
rtc::scoped_ptr<AudioProcessing> apm_;
std::unique_ptr<AudioProcessing> apm_;
const SimulationConfig simulation_config_;
FrameCounters frame_counters_;
LockedFlag capture_call_checker_;
rtc::scoped_ptr<TimedThreadApiProcessor> render_thread_state_;
rtc::scoped_ptr<TimedThreadApiProcessor> capture_thread_state_;
std::unique_ptr<TimedThreadApiProcessor> render_thread_state_;
std::unique_ptr<TimedThreadApiProcessor> capture_thread_state_;
};
// Implements the callback functionality for the threads.

View File

@ -14,7 +14,6 @@
#include <complex>
#include "webrtc/base/checks.h"
#include "webrtc/base/scoped_ptr.h"
#include "webrtc/modules/audio_processing/beamformer/matrix.h"
namespace webrtc {

View File

@ -18,7 +18,6 @@
#include "webrtc/base/checks.h"
#include "webrtc/base/constructormagic.h"
#include "webrtc/base/scoped_ptr.h"
namespace {

View File

@ -15,6 +15,8 @@
#define _USE_MATH_DEFINES
#include <math.h>
#include <memory>
#include <vector>
#include "webrtc/common_audio/lapped_transform.h"
@ -125,7 +127,7 @@ class NonlinearBeamformer
// Deals with the fft transform and blocking.
size_t chunk_length_;
rtc::scoped_ptr<LappedTransform> lapped_transform_;
std::unique_ptr<LappedTransform> lapped_transform_;
float window_[kFftSize];
// Parameters exposed to the user.

View File

@ -11,8 +11,9 @@
#ifndef WEBRTC_MODULES_AUDIO_PROCESSING_ECHO_CANCELLATION_IMPL_H_
#define WEBRTC_MODULES_AUDIO_PROCESSING_ECHO_CANCELLATION_IMPL_H_
#include <memory>
#include "webrtc/base/criticalsection.h"
#include "webrtc/base/scoped_ptr.h"
#include "webrtc/common_audio/swap_queue.h"
#include "webrtc/modules/audio_processing/include/audio_processing.h"
#include "webrtc/modules/audio_processing/processing_component.h"
@ -101,7 +102,7 @@ class EchoCancellationImpl : public EchoCancellation,
std::vector<float> capture_queue_buffer_ GUARDED_BY(crit_capture_);
// Lock protection not needed.
rtc::scoped_ptr<SwapQueue<std::vector<float>, RenderQueueItemVerifier<float>>>
std::unique_ptr<SwapQueue<std::vector<float>, RenderQueueItemVerifier<float>>>
render_signal_queue_;
};

View File

@ -8,8 +8,9 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#include <memory>
#include "testing/gtest/include/gtest/gtest.h"
#include "webrtc/base/scoped_ptr.h"
extern "C" {
#include "webrtc/modules/audio_processing/aec/aec_core.h"
}
@ -18,7 +19,7 @@ extern "C" {
namespace webrtc {
TEST(EchoCancellationInternalTest, ExtendedFilter) {
rtc::scoped_ptr<AudioProcessing> ap(AudioProcessing::Create());
std::unique_ptr<AudioProcessing> ap(AudioProcessing::Create());
EXPECT_TRUE(ap->echo_cancellation()->aec_core() == NULL);
EXPECT_EQ(ap->kNoError, ap->echo_cancellation()->Enable(true));
@ -48,7 +49,7 @@ TEST(EchoCancellationInternalTest, ExtendedFilter) {
}
TEST(EchoCancellationInternalTest, DelayAgnostic) {
rtc::scoped_ptr<AudioProcessing> ap(AudioProcessing::Create());
std::unique_ptr<AudioProcessing> ap(AudioProcessing::Create());
EXPECT_TRUE(ap->echo_cancellation()->aec_core() == NULL);
EXPECT_EQ(ap->kNoError, ap->echo_cancellation()->Enable(true));

View File

@ -11,8 +11,9 @@
#ifndef WEBRTC_MODULES_AUDIO_PROCESSING_ECHO_CONTROL_MOBILE_IMPL_H_
#define WEBRTC_MODULES_AUDIO_PROCESSING_ECHO_CONTROL_MOBILE_IMPL_H_
#include <memory>
#include "webrtc/base/criticalsection.h"
#include "webrtc/base/scoped_ptr.h"
#include "webrtc/common_audio/swap_queue.h"
#include "webrtc/modules/audio_processing/include/audio_processing.h"
#include "webrtc/modules/audio_processing/processing_component.h"
@ -81,7 +82,7 @@ class EchoControlMobileImpl : public EchoControlMobile,
std::vector<int16_t> capture_queue_buffer_ GUARDED_BY(crit_capture_);
// Lock protection not needed.
rtc::scoped_ptr<
std::unique_ptr<
SwapQueue<std::vector<int16_t>, RenderQueueItemVerifier<int16_t>>>
render_signal_queue_;
};

View File

@ -11,10 +11,10 @@
#ifndef WEBRTC_MODULES_AUDIO_PROCESSING_GAIN_CONTROL_IMPL_H_
#define WEBRTC_MODULES_AUDIO_PROCESSING_GAIN_CONTROL_IMPL_H_
#include <memory>
#include <vector>
#include "webrtc/base/criticalsection.h"
#include "webrtc/base/scoped_ptr.h"
#include "webrtc/base/thread_annotations.h"
#include "webrtc/common_audio/swap_queue.h"
#include "webrtc/modules/audio_processing/include/audio_processing.h"
@ -96,7 +96,7 @@ class GainControlImpl : public GainControl,
std::vector<int16_t> capture_queue_buffer_ GUARDED_BY(crit_capture_);
// Lock protection not needed.
rtc::scoped_ptr<
std::unique_ptr<
SwapQueue<std::vector<int16_t>, RenderQueueItemVerifier<int16_t>>>
render_signal_queue_;
};

View File

@ -93,7 +93,7 @@ HighPassFilterImpl::HighPassFilterImpl(rtc::CriticalSection* crit)
HighPassFilterImpl::~HighPassFilterImpl() {}
void HighPassFilterImpl::Initialize(size_t channels, int sample_rate_hz) {
std::vector<rtc::scoped_ptr<BiquadFilter>> new_filters(channels);
std::vector<std::unique_ptr<BiquadFilter>> new_filters(channels);
for (size_t i = 0; i < channels; i++) {
new_filters[i].reset(new BiquadFilter(sample_rate_hz));
}

View File

@ -11,9 +11,10 @@
#ifndef WEBRTC_MODULES_AUDIO_PROCESSING_HIGH_PASS_FILTER_IMPL_H_
#define WEBRTC_MODULES_AUDIO_PROCESSING_HIGH_PASS_FILTER_IMPL_H_
#include <memory>
#include "webrtc/base/constructormagic.h"
#include "webrtc/base/criticalsection.h"
#include "webrtc/base/scoped_ptr.h"
#include "webrtc/modules/audio_processing/include/audio_processing.h"
namespace webrtc {
@ -37,7 +38,7 @@ class HighPassFilterImpl : public HighPassFilter {
class BiquadFilter;
rtc::CriticalSection* const crit_ = nullptr;
bool enabled_ GUARDED_BY(crit_) = false;
std::vector<rtc::scoped_ptr<BiquadFilter>> filters_ GUARDED_BY(crit_);
std::vector<std::unique_ptr<BiquadFilter>> filters_ GUARDED_BY(crit_);
RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(HighPassFilterImpl);
};
} // namespace webrtc

View File

@ -11,7 +11,8 @@
#ifndef WEBRTC_MODULES_AUDIO_PROCESSING_INCLUDE_MOCK_AUDIO_PROCESSING_H_
#define WEBRTC_MODULES_AUDIO_PROCESSING_INCLUDE_MOCK_AUDIO_PROCESSING_H_
#include "webrtc/base/scoped_ptr.h"
#include <memory>
#include "webrtc/modules/audio_processing/include/audio_processing.h"
namespace webrtc {
@ -282,13 +283,13 @@ class MockAudioProcessing : public AudioProcessing {
}
private:
rtc::scoped_ptr<MockEchoCancellation> echo_cancellation_;
rtc::scoped_ptr<MockEchoControlMobile> echo_control_mobile_;
rtc::scoped_ptr<MockGainControl> gain_control_;
rtc::scoped_ptr<MockHighPassFilter> high_pass_filter_;
rtc::scoped_ptr<MockLevelEstimator> level_estimator_;
rtc::scoped_ptr<MockNoiseSuppression> noise_suppression_;
rtc::scoped_ptr<MockVoiceDetection> voice_detection_;
std::unique_ptr<MockEchoCancellation> echo_cancellation_;
std::unique_ptr<MockEchoControlMobile> echo_control_mobile_;
std::unique_ptr<MockGainControl> gain_control_;
std::unique_ptr<MockHighPassFilter> high_pass_filter_;
std::unique_ptr<MockLevelEstimator> level_estimator_;
std::unique_ptr<MockNoiseSuppression> noise_suppression_;
std::unique_ptr<MockVoiceDetection> voice_detection_;
};
} // namespace webrtc

View File

@ -12,9 +12,9 @@
#define WEBRTC_MODULES_AUDIO_PROCESSING_INTELLIGIBILITY_INTELLIGIBILITY_ENHANCER_H_
#include <complex>
#include <memory>
#include <vector>
#include "webrtc/base/scoped_ptr.h"
#include "webrtc/common_audio/lapped_transform.h"
#include "webrtc/common_audio/channel_buffer.h"
#include "webrtc/modules/audio_processing/intelligibility/intelligibility_utils.h"
@ -120,24 +120,24 @@ class IntelligibilityEnhancer {
intelligibility::PowerEstimator clear_power_;
std::vector<float> noise_power_;
rtc::scoped_ptr<float[]> filtered_clear_pow_;
rtc::scoped_ptr<float[]> filtered_noise_pow_;
rtc::scoped_ptr<float[]> center_freqs_;
std::unique_ptr<float[]> filtered_clear_pow_;
std::unique_ptr<float[]> filtered_noise_pow_;
std::unique_ptr<float[]> center_freqs_;
std::vector<std::vector<float>> capture_filter_bank_;
std::vector<std::vector<float>> render_filter_bank_;
size_t start_freq_;
rtc::scoped_ptr<float[]> rho_; // Production and interpretation SNR.
std::unique_ptr<float[]> rho_; // Production and interpretation SNR.
// for each ERB band.
rtc::scoped_ptr<float[]> gains_eq_; // Pre-filter modified gains.
std::unique_ptr<float[]> gains_eq_; // Pre-filter modified gains.
intelligibility::GainApplier gain_applier_;
// Destination buffers used to reassemble blocked chunks before overwriting
// the original input array with modifications.
ChannelBuffer<float> temp_render_out_buffer_;
rtc::scoped_ptr<float[]> kbd_window_;
std::unique_ptr<float[]> kbd_window_;
TransformCallback render_callback_;
rtc::scoped_ptr<LappedTransform> render_mangler_;
std::unique_ptr<LappedTransform> render_mangler_;
int block_count_;
int analysis_step_;
};

View File

@ -10,12 +10,13 @@
#include <math.h>
#include <stdlib.h>
#include <algorithm>
#include <memory>
#include <vector>
#include "testing/gtest/include/gtest/gtest.h"
#include "webrtc/base/arraysize.h"
#include "webrtc/base/scoped_ptr.h"
#include "webrtc/common_audio/signal_processing/include/signal_processing_library.h"
#include "webrtc/modules/audio_processing/intelligibility/intelligibility_enhancer.h"
@ -105,7 +106,7 @@ class IntelligibilityEnhancerTest : public ::testing::Test {
}
IntelligibilityEnhancer::Config config_;
rtc::scoped_ptr<IntelligibilityEnhancer> enh_;
std::unique_ptr<IntelligibilityEnhancer> enh_;
std::vector<float> clear_data_;
std::vector<float> noise_data_;
std::vector<float> orig_data_;

View File

@ -12,8 +12,7 @@
#define WEBRTC_MODULES_AUDIO_PROCESSING_INTELLIGIBILITY_INTELLIGIBILITY_UTILS_H_
#include <complex>
#include "webrtc/base/scoped_ptr.h"
#include <memory>
namespace webrtc {
@ -36,13 +35,13 @@ class PowerEstimator {
private:
// TODO(ekmeyerson): Switch the following running means
// and histories from rtc::scoped_ptr to std::vector.
rtc::scoped_ptr<std::complex<float>[]> running_mean_sq_;
// and histories from std::unique_ptr to std::vector.
std::unique_ptr<std::complex<float>[]> running_mean_sq_;
// The current magnitude array.
rtc::scoped_ptr<float[]> magnitude_;
std::unique_ptr<float[]> magnitude_;
// The current power array.
rtc::scoped_ptr<float[]> power_;
std::unique_ptr<float[]> power_;
const size_t num_freqs_;
const float decay_;
@ -66,8 +65,8 @@ class GainApplier {
private:
const size_t num_freqs_;
const float change_limit_;
rtc::scoped_ptr<float[]> target_;
rtc::scoped_ptr<float[]> current_;
std::unique_ptr<float[]> target_;
std::unique_ptr<float[]> current_;
};
} // namespace intelligibility

View File

@ -11,9 +11,10 @@
#ifndef WEBRTC_MODULES_AUDIO_PROCESSING_LEVEL_ESTIMATOR_IMPL_H_
#define WEBRTC_MODULES_AUDIO_PROCESSING_LEVEL_ESTIMATOR_IMPL_H_
#include <memory>
#include "webrtc/base/constructormagic.h"
#include "webrtc/base/criticalsection.h"
#include "webrtc/base/scoped_ptr.h"
#include "webrtc/modules/audio_processing/include/audio_processing.h"
namespace webrtc {
@ -38,7 +39,7 @@ class LevelEstimatorImpl : public LevelEstimator {
private:
rtc::CriticalSection* const crit_ = nullptr;
bool enabled_ GUARDED_BY(crit_) = false;
rtc::scoped_ptr<RMSLevel> rms_ GUARDED_BY(crit_);
std::unique_ptr<RMSLevel> rms_ GUARDED_BY(crit_);
RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(LevelEstimatorImpl);
};
} // namespace webrtc

View File

@ -56,7 +56,7 @@ void NoiseSuppressionImpl::Initialize(size_t channels, int sample_rate_hz) {
rtc::CritScope cs(crit_);
channels_ = channels;
sample_rate_hz_ = sample_rate_hz;
std::vector<rtc::scoped_ptr<Suppressor>> new_suppressors;
std::vector<std::unique_ptr<Suppressor>> new_suppressors;
if (enabled_) {
new_suppressors.resize(channels);
for (size_t i = 0; i < channels; i++) {

View File

@ -11,11 +11,11 @@
#ifndef WEBRTC_MODULES_AUDIO_PROCESSING_NOISE_SUPPRESSION_IMPL_H_
#define WEBRTC_MODULES_AUDIO_PROCESSING_NOISE_SUPPRESSION_IMPL_H_
#include <memory>
#include <vector>
#include "webrtc/base/constructormagic.h"
#include "webrtc/base/criticalsection.h"
#include "webrtc/base/scoped_ptr.h"
#include "webrtc/modules/audio_processing/include/audio_processing.h"
namespace webrtc {
@ -47,7 +47,7 @@ class NoiseSuppressionImpl : public NoiseSuppression {
Level level_ GUARDED_BY(crit_) = kModerate;
size_t channels_ GUARDED_BY(crit_) = 0;
int sample_rate_hz_ GUARDED_BY(crit_) = 0;
std::vector<rtc::scoped_ptr<Suppressor>> suppressors_ GUARDED_BY(crit_);
std::vector<std::unique_ptr<Suppressor>> suppressors_ GUARDED_BY(crit_);
RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(NoiseSuppressionImpl);
};
} // namespace webrtc

View File

@ -41,7 +41,7 @@ VoiceDetectionImpl::~VoiceDetectionImpl() {}
void VoiceDetectionImpl::Initialize(int sample_rate_hz) {
rtc::CritScope cs(crit_);
sample_rate_hz_ = sample_rate_hz;
rtc::scoped_ptr<Vad> new_vad;
std::unique_ptr<Vad> new_vad;
if (enabled_) {
new_vad.reset(new Vad());
}

View File

@ -11,9 +11,10 @@
#ifndef WEBRTC_MODULES_AUDIO_PROCESSING_VOICE_DETECTION_IMPL_H_
#define WEBRTC_MODULES_AUDIO_PROCESSING_VOICE_DETECTION_IMPL_H_
#include <memory>
#include "webrtc/base/constructormagic.h"
#include "webrtc/base/criticalsection.h"
#include "webrtc/base/scoped_ptr.h"
#include "webrtc/modules/audio_processing/include/audio_processing.h"
namespace webrtc {
@ -49,7 +50,7 @@ class VoiceDetectionImpl : public VoiceDetection {
int frame_size_ms_ GUARDED_BY(crit_) = 10;
size_t frame_size_samples_ GUARDED_BY(crit_) = 0;
int sample_rate_hz_ GUARDED_BY(crit_) = 0;
rtc::scoped_ptr<Vad> vad_ GUARDED_BY(crit_);
std::unique_ptr<Vad> vad_ GUARDED_BY(crit_);
RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(VoiceDetectionImpl);
};
} // namespace webrtc

View File

@ -17,6 +17,7 @@
#include "gflags/gflags.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "webrtc/base/scoped_ptr.h"
#include "webrtc/modules/audio_processing/agc/agc.h"
#include "webrtc/modules/audio_processing/agc/histogram.h"
#include "webrtc/modules/audio_processing/agc/utility.h"