Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(186)

Side by Side Diff: webrtc/modules/audio_processing/test/audioproc_float.cc

Issue 1694423002: Replace scoped_ptr with unique_ptr in webrtc/modules/audio_processing/test/ (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 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 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 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
11 #include <stdio.h> 11 #include <stdio.h>
12
12 #include <iostream> 13 #include <iostream>
14 #include <memory>
13 #include <sstream> 15 #include <sstream>
14 #include <string> 16 #include <string>
15 #include <utility> 17 #include <utility>
16 18
17 #include "gflags/gflags.h" 19 #include "gflags/gflags.h"
18 #include "webrtc/base/checks.h" 20 #include "webrtc/base/checks.h"
19 #include "webrtc/base/format_macros.h" 21 #include "webrtc/base/format_macros.h"
20 #include "webrtc/base/scoped_ptr.h"
21 #include "webrtc/common_audio/channel_buffer.h" 22 #include "webrtc/common_audio/channel_buffer.h"
22 #include "webrtc/common_audio/wav_file.h" 23 #include "webrtc/common_audio/wav_file.h"
23 #include "webrtc/modules/audio_processing/include/audio_processing.h" 24 #include "webrtc/modules/audio_processing/include/audio_processing.h"
24 #include "webrtc/modules/audio_processing/test/audio_file_processor.h" 25 #include "webrtc/modules/audio_processing/test/audio_file_processor.h"
25 #include "webrtc/modules/audio_processing/test/protobuf_utils.h" 26 #include "webrtc/modules/audio_processing/test/protobuf_utils.h"
26 #include "webrtc/modules/audio_processing/test/test_utils.h" 27 #include "webrtc/modules/audio_processing/test/test_utils.h"
27 #include "webrtc/system_wrappers/include/tick_util.h" 28 #include "webrtc/system_wrappers/include/tick_util.h"
28 #include "webrtc/test/testsupport/trace_to_stderr.h" 29 #include "webrtc/test/testsupport/trace_to_stderr.h"
29 30
30 namespace { 31 namespace {
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 return 1; 109 return 1;
109 } 110 }
110 config.Set<Beamforming>(new Beamforming( 111 config.Set<Beamforming>(new Beamforming(
111 true, ParseArrayGeometry(FLAGS_mic_positions), 112 true, ParseArrayGeometry(FLAGS_mic_positions),
112 SphericalPointf(DegreesToRadians(FLAGS_target_angle_degrees), 0.f, 113 SphericalPointf(DegreesToRadians(FLAGS_target_angle_degrees), 0.f,
113 1.f))); 114 1.f)));
114 } 115 }
115 config.Set<ExperimentalNs>(new ExperimentalNs(FLAGS_ts || FLAGS_all)); 116 config.Set<ExperimentalNs>(new ExperimentalNs(FLAGS_ts || FLAGS_all));
116 config.Set<Intelligibility>(new Intelligibility(FLAGS_ie || FLAGS_all)); 117 config.Set<Intelligibility>(new Intelligibility(FLAGS_ie || FLAGS_all));
117 118
118 rtc::scoped_ptr<AudioProcessing> ap(AudioProcessing::Create(config)); 119 std::unique_ptr<AudioProcessing> ap(AudioProcessing::Create(config));
119 RTC_CHECK_EQ(kNoErr, ap->echo_cancellation()->Enable(FLAGS_aec || FLAGS_all)); 120 RTC_CHECK_EQ(kNoErr, ap->echo_cancellation()->Enable(FLAGS_aec || FLAGS_all));
120 RTC_CHECK_EQ(kNoErr, ap->gain_control()->Enable(FLAGS_agc || FLAGS_all)); 121 RTC_CHECK_EQ(kNoErr, ap->gain_control()->Enable(FLAGS_agc || FLAGS_all));
121 RTC_CHECK_EQ(kNoErr, ap->high_pass_filter()->Enable(FLAGS_hpf || FLAGS_all)); 122 RTC_CHECK_EQ(kNoErr, ap->high_pass_filter()->Enable(FLAGS_hpf || FLAGS_all));
122 RTC_CHECK_EQ(kNoErr, ap->noise_suppression()->Enable(FLAGS_ns || FLAGS_all)); 123 RTC_CHECK_EQ(kNoErr, ap->noise_suppression()->Enable(FLAGS_ns || FLAGS_all));
123 if (FLAGS_ns_level != -1) { 124 if (FLAGS_ns_level != -1) {
124 RTC_CHECK_EQ(kNoErr, 125 RTC_CHECK_EQ(kNoErr,
125 ap->noise_suppression()->set_level( 126 ap->noise_suppression()->set_level(
126 static_cast<NoiseSuppression::Level>(FLAGS_ns_level))); 127 static_cast<NoiseSuppression::Level>(FLAGS_ns_level)));
127 } 128 }
128 ap->set_stream_key_pressed(FLAGS_ts); 129 ap->set_stream_key_pressed(FLAGS_ts);
129 130
130 rtc::scoped_ptr<AudioFileProcessor> processor; 131 std::unique_ptr<AudioFileProcessor> processor;
131 auto out_file = rtc_make_scoped_ptr(new WavWriter( 132 auto out_file = std::unique_ptr<WavWriter>(new WavWriter(
132 FLAGS_o, FLAGS_out_sample_rate, static_cast<size_t>(FLAGS_out_channels))); 133 FLAGS_o, FLAGS_out_sample_rate, static_cast<size_t>(FLAGS_out_channels)));
133 std::cout << FLAGS_o << ": " << out_file->FormatAsString() << std::endl; 134 std::cout << FLAGS_o << ": " << out_file->FormatAsString() << std::endl;
134 if (FLAGS_dump.empty()) { 135 if (FLAGS_dump.empty()) {
135 auto in_file = rtc_make_scoped_ptr(new WavReader(FLAGS_i)); 136 auto in_file = std::unique_ptr<WavReader>(new WavReader(FLAGS_i));
136 std::cout << FLAGS_i << ": " << in_file->FormatAsString() << std::endl; 137 std::cout << FLAGS_i << ": " << in_file->FormatAsString() << std::endl;
137 processor.reset(new WavFileProcessor(std::move(ap), std::move(in_file), 138 processor.reset(new WavFileProcessor(std::move(ap), std::move(in_file),
138 std::move(out_file))); 139 std::move(out_file)));
139 140
140 } else { 141 } else {
141 processor.reset(new AecDumpFileProcessor( 142 processor.reset(new AecDumpFileProcessor(
142 std::move(ap), fopen(FLAGS_dump.c_str(), "rb"), std::move(out_file))); 143 std::move(ap), fopen(FLAGS_dump.c_str(), "rb"), std::move(out_file)));
143 } 144 }
144 145
145 int num_chunks = 0; 146 int num_chunks = 0;
(...skipping 14 matching lines...) Expand all
160 } 161 }
161 162
162 return 0; 163 return 0;
163 } 164 }
164 165
165 } // namespace webrtc 166 } // namespace webrtc
166 167
167 int main(int argc, char* argv[]) { 168 int main(int argc, char* argv[]) {
168 return webrtc::main(argc, argv); 169 return webrtc::main(argc, argv);
169 } 170 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698