Index: webrtc/modules/audio_processing/test/audio_processing_unittest.cc |
diff --git a/webrtc/modules/audio_processing/test/audio_processing_unittest.cc b/webrtc/modules/audio_processing/test/audio_processing_unittest.cc |
index df3273e19a743c8af0fc614a9b1fba5f24afe4ce..3ffed874444b70f120dfa58b20db894fd34e707e 100644 |
--- a/webrtc/modules/audio_processing/test/audio_processing_unittest.cc |
+++ b/webrtc/modules/audio_processing/test/audio_processing_unittest.cc |
@@ -10,12 +10,13 @@ |
#include <math.h> |
#include <stdio.h> |
+ |
#include <algorithm> |
#include <limits> |
+#include <memory> |
#include <queue> |
#include "webrtc/base/arraysize.h" |
-#include "webrtc/base/scoped_ptr.h" |
#include "webrtc/common_audio/include/audio_util.h" |
#include "webrtc/common_audio/resampler/include/push_resampler.h" |
#include "webrtc/common_audio/resampler/push_sinc_resampler.h" |
@@ -226,7 +227,7 @@ void OpenFileAndWriteMessage(const std::string filename, |
int32_t size = msg.ByteSize(); |
ASSERT_GT(size, 0); |
- rtc::scoped_ptr<uint8_t[]> array(new uint8_t[size]); |
+ std::unique_ptr<uint8_t[]> array(new uint8_t[size]); |
ASSERT_TRUE(msg.SerializeToArray(array.get(), size)); |
ASSERT_EQ(1u, fwrite(&size, sizeof(size), 1, file)); |
@@ -390,11 +391,11 @@ class ApmTest : public ::testing::Test { |
const std::string output_path_; |
const std::string ref_path_; |
const std::string ref_filename_; |
- rtc::scoped_ptr<AudioProcessing> apm_; |
+ std::unique_ptr<AudioProcessing> apm_; |
AudioFrame* frame_; |
AudioFrame* revframe_; |
- rtc::scoped_ptr<ChannelBuffer<float> > float_cb_; |
- rtc::scoped_ptr<ChannelBuffer<float> > revfloat_cb_; |
+ std::unique_ptr<ChannelBuffer<float> > float_cb_; |
+ std::unique_ptr<ChannelBuffer<float> > revfloat_cb_; |
int output_sample_rate_hz_; |
size_t num_output_channels_; |
FILE* far_file_; |
@@ -1079,8 +1080,8 @@ TEST_F(ApmTest, EchoControlMobile) { |
// Set and get echo path |
const size_t echo_path_size = |
apm_->echo_control_mobile()->echo_path_size_bytes(); |
- rtc::scoped_ptr<char[]> echo_path_in(new char[echo_path_size]); |
- rtc::scoped_ptr<char[]> echo_path_out(new char[echo_path_size]); |
+ std::unique_ptr<char[]> echo_path_in(new char[echo_path_size]); |
+ std::unique_ptr<char[]> echo_path_out(new char[echo_path_size]); |
EXPECT_EQ(apm_->kNullPointerError, |
apm_->echo_control_mobile()->SetEchoPath(NULL, echo_path_size)); |
EXPECT_EQ(apm_->kNullPointerError, |
@@ -1305,15 +1306,15 @@ TEST_F(ApmTest, AgcOnlyAdaptsWhenTargetSignalIsPresent) { |
config.Set<Beamforming>(new Beamforming(true, geometry)); |
testing::NiceMock<MockNonlinearBeamformer>* beamformer = |
new testing::NiceMock<MockNonlinearBeamformer>(geometry); |
- rtc::scoped_ptr<AudioProcessing> apm( |
+ std::unique_ptr<AudioProcessing> apm( |
AudioProcessing::Create(config, beamformer)); |
EXPECT_EQ(kNoErr, apm->gain_control()->Enable(true)); |
ChannelBuffer<float> src_buf(kSamplesPerChannel, kNumInputChannels); |
ChannelBuffer<float> dest_buf(kSamplesPerChannel, kNumOutputChannels); |
const size_t max_length = kSamplesPerChannel * std::max(kNumInputChannels, |
kNumOutputChannels); |
- rtc::scoped_ptr<int16_t[]> int_data(new int16_t[max_length]); |
- rtc::scoped_ptr<float[]> float_data(new float[max_length]); |
+ std::unique_ptr<int16_t[]> int_data(new int16_t[max_length]); |
+ std::unique_ptr<float[]> float_data(new float[max_length]); |
std::string filename = ResourceFilePath("far", kSampleRateHz); |
FILE* far_file = fopen(filename.c_str(), "rb"); |
ASSERT_TRUE(far_file != NULL) << "Could not open file " << filename << "\n"; |
@@ -1828,9 +1829,9 @@ void ApmTest::VerifyDebugDumpTest(Format format) { |
ASSERT_TRUE(ref_file != NULL); |
ASSERT_TRUE(out_file != NULL); |
ASSERT_TRUE(limited_file != NULL); |
- rtc::scoped_ptr<uint8_t[]> ref_bytes; |
- rtc::scoped_ptr<uint8_t[]> out_bytes; |
- rtc::scoped_ptr<uint8_t[]> limited_bytes; |
+ std::unique_ptr<uint8_t[]> ref_bytes; |
+ std::unique_ptr<uint8_t[]> out_bytes; |
+ std::unique_ptr<uint8_t[]> limited_bytes; |
size_t ref_size = ReadMessageBytesFromFile(ref_file, &ref_bytes); |
size_t out_size = ReadMessageBytesFromFile(out_file, &out_bytes); |
@@ -1944,7 +1945,7 @@ TEST_F(ApmTest, FloatAndIntInterfacesGiveSimilarResults) { |
Config config; |
config.Set<ExperimentalAgc>(new ExperimentalAgc(false)); |
- rtc::scoped_ptr<AudioProcessing> fapm(AudioProcessing::Create(config)); |
+ std::unique_ptr<AudioProcessing> fapm(AudioProcessing::Create(config)); |
EnableAllComponents(); |
EnableAllAPComponents(fapm.get()); |
for (int i = 0; i < ref_data.test_size(); i++) { |
@@ -2285,7 +2286,7 @@ TEST_F(ApmTest, NoErrorsWithKeyboardChannel) { |
{AudioProcessing::kStereoAndKeyboard, AudioProcessing::kStereo}, |
}; |
- rtc::scoped_ptr<AudioProcessing> ap(AudioProcessing::Create()); |
+ std::unique_ptr<AudioProcessing> ap(AudioProcessing::Create()); |
// Enable one component just to ensure some processing takes place. |
ap->noise_suppression()->Enable(true); |
for (size_t i = 0; i < arraysize(cf); ++i) { |
@@ -2410,7 +2411,7 @@ class AudioProcessingTest |
std::string output_file_prefix) { |
Config config; |
config.Set<ExperimentalAgc>(new ExperimentalAgc(false)); |
- rtc::scoped_ptr<AudioProcessing> ap(AudioProcessing::Create(config)); |
+ std::unique_ptr<AudioProcessing> ap(AudioProcessing::Create(config)); |
EnableAllAPComponents(ap.get()); |
ProcessingConfig processing_config = { |
@@ -2455,8 +2456,8 @@ class AudioProcessingTest |
const int max_length = |
2 * std::max(std::max(out_cb.num_frames(), rev_out_cb.num_frames()), |
std::max(fwd_cb.num_frames(), rev_cb.num_frames())); |
- rtc::scoped_ptr<float[]> float_data(new float[max_length]); |
- rtc::scoped_ptr<int16_t[]> int_data(new int16_t[max_length]); |
+ std::unique_ptr<float[]> float_data(new float[max_length]); |
+ std::unique_ptr<int16_t[]> int_data(new int16_t[max_length]); |
int analog_level = 127; |
while (ReadChunk(far_file, int_data.get(), float_data.get(), &rev_cb) && |
@@ -2583,12 +2584,12 @@ TEST_P(AudioProcessingTest, Formats) { |
const size_t ref_length = SamplesFromRate(ref_rate) * out_num; |
const size_t out_length = SamplesFromRate(out_rate) * out_num; |
// Data from the reference file. |
- rtc::scoped_ptr<float[]> ref_data(new float[ref_length]); |
+ std::unique_ptr<float[]> ref_data(new float[ref_length]); |
// Data from the output file. |
- rtc::scoped_ptr<float[]> out_data(new float[out_length]); |
+ std::unique_ptr<float[]> out_data(new float[out_length]); |
// Data from the resampled output, in case the reference and output rates |
// don't match. |
- rtc::scoped_ptr<float[]> cmp_data(new float[ref_length]); |
+ std::unique_ptr<float[]> cmp_data(new float[ref_length]); |
PushResampler<float> resampler; |
resampler.InitializeIfNeeded(out_rate, ref_rate, out_num); |