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

Side by Side Diff: webrtc/modules/audio_processing/audio_processing_impl.h

Issue 1710483002: Replace scoped_ptr with unique_ptr in webrtc/modules/audio_processing/ (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: rebase 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) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 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 #ifndef WEBRTC_MODULES_AUDIO_PROCESSING_AUDIO_PROCESSING_IMPL_H_ 11 #ifndef WEBRTC_MODULES_AUDIO_PROCESSING_AUDIO_PROCESSING_IMPL_H_
12 #define WEBRTC_MODULES_AUDIO_PROCESSING_AUDIO_PROCESSING_IMPL_H_ 12 #define WEBRTC_MODULES_AUDIO_PROCESSING_AUDIO_PROCESSING_IMPL_H_
13 13
14 #include <list> 14 #include <list>
15 #include <memory>
15 #include <string> 16 #include <string>
16 #include <vector> 17 #include <vector>
17 18
18 #include "webrtc/base/criticalsection.h" 19 #include "webrtc/base/criticalsection.h"
19 #include "webrtc/base/scoped_ptr.h"
20 #include "webrtc/base/thread_annotations.h" 20 #include "webrtc/base/thread_annotations.h"
21 #include "webrtc/modules/audio_processing/audio_buffer.h" 21 #include "webrtc/modules/audio_processing/audio_buffer.h"
22 #include "webrtc/modules/audio_processing/include/audio_processing.h" 22 #include "webrtc/modules/audio_processing/include/audio_processing.h"
23 #include "webrtc/system_wrappers/include/file_wrapper.h" 23 #include "webrtc/system_wrappers/include/file_wrapper.h"
24 24
25 #ifdef WEBRTC_AUDIOPROC_DEBUG_DUMP 25 #ifdef WEBRTC_AUDIOPROC_DEBUG_DUMP
26 // Files generated at build-time by the protobuf compiler. 26 // Files generated at build-time by the protobuf compiler.
27 #ifdef WEBRTC_ANDROID_PLATFORM_BUILD 27 #ifdef WEBRTC_ANDROID_PLATFORM_BUILD
28 #include "external/webrtc/webrtc/modules/audio_processing/debug.pb.h" 28 #include "external/webrtc/webrtc/modules/audio_processing/debug.pb.h"
29 #else 29 #else
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 EXCLUSIVE_LOCKS_REQUIRED(crit_render_, crit_capture_); 130 EXCLUSIVE_LOCKS_REQUIRED(crit_render_, crit_capture_);
131 131
132 private: 132 private:
133 struct ApmPublicSubmodules; 133 struct ApmPublicSubmodules;
134 struct ApmPrivateSubmodules; 134 struct ApmPrivateSubmodules;
135 135
136 #ifdef WEBRTC_AUDIOPROC_DEBUG_DUMP 136 #ifdef WEBRTC_AUDIOPROC_DEBUG_DUMP
137 // State for the debug dump. 137 // State for the debug dump.
138 struct ApmDebugDumpThreadState { 138 struct ApmDebugDumpThreadState {
139 ApmDebugDumpThreadState() : event_msg(new audioproc::Event()) {} 139 ApmDebugDumpThreadState() : event_msg(new audioproc::Event()) {}
140 rtc::scoped_ptr<audioproc::Event> event_msg; // Protobuf message. 140 std::unique_ptr<audioproc::Event> event_msg; // Protobuf message.
141 std::string event_str; // Memory for protobuf serialization. 141 std::string event_str; // Memory for protobuf serialization.
142 142
143 // Serialized string of last saved APM configuration. 143 // Serialized string of last saved APM configuration.
144 std::string last_serialized_config; 144 std::string last_serialized_config;
145 }; 145 };
146 146
147 struct ApmDebugDumpState { 147 struct ApmDebugDumpState {
148 ApmDebugDumpState() : debug_file(FileWrapper::Create()) {} 148 ApmDebugDumpState() : debug_file(FileWrapper::Create()) {}
149 // Number of bytes that can still be written to the log before the maximum 149 // Number of bytes that can still be written to the log before the maximum
150 // size is reached. A value of <= 0 indicates that no limit is used. 150 // size is reached. A value of <= 0 indicates that no limit is used.
151 int64_t num_bytes_left_for_log_ = -1; 151 int64_t num_bytes_left_for_log_ = -1;
152 rtc::scoped_ptr<FileWrapper> debug_file; 152 std::unique_ptr<FileWrapper> debug_file;
153 ApmDebugDumpThreadState render; 153 ApmDebugDumpThreadState render;
154 ApmDebugDumpThreadState capture; 154 ApmDebugDumpThreadState capture;
155 }; 155 };
156 #endif 156 #endif
157 157
158 // Method for modifying the formats struct that are called from both 158 // Method for modifying the formats struct that are called from both
159 // the render and capture threads. The check for whether modifications 159 // the render and capture threads. The check for whether modifications
160 // are needed is done while holding the render lock only, thereby avoiding 160 // are needed is done while holding the render lock only, thereby avoiding
161 // that the capture thread blocks the render thread. 161 // that the capture thread blocks the render thread.
162 // The struct is modified in a single-threaded manner by holding both the 162 // The struct is modified in a single-threaded manner by holding both the
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 243
244 // Debug dump state. 244 // Debug dump state.
245 ApmDebugDumpState debug_dump_; 245 ApmDebugDumpState debug_dump_;
246 #endif 246 #endif
247 247
248 // Critical sections. 248 // Critical sections.
249 rtc::CriticalSection crit_render_ ACQUIRED_BEFORE(crit_capture_); 249 rtc::CriticalSection crit_render_ ACQUIRED_BEFORE(crit_capture_);
250 rtc::CriticalSection crit_capture_; 250 rtc::CriticalSection crit_capture_;
251 251
252 // Structs containing the pointers to the submodules. 252 // Structs containing the pointers to the submodules.
253 rtc::scoped_ptr<ApmPublicSubmodules> public_submodules_; 253 std::unique_ptr<ApmPublicSubmodules> public_submodules_;
254 rtc::scoped_ptr<ApmPrivateSubmodules> private_submodules_ 254 std::unique_ptr<ApmPrivateSubmodules> private_submodules_
255 GUARDED_BY(crit_capture_); 255 GUARDED_BY(crit_capture_);
256 256
257 // State that is written to while holding both the render and capture locks 257 // State that is written to while holding both the render and capture locks
258 // but can be read without any lock being held. 258 // but can be read without any lock being held.
259 // As this is only accessed internally of APM, and all internal methods in APM 259 // As this is only accessed internally of APM, and all internal methods in APM
260 // either are holding the render or capture locks, this construct is safe as 260 // either are holding the render or capture locks, this construct is safe as
261 // it is not possible to read the variables while writing them. 261 // it is not possible to read the variables while writing them.
262 struct ApmFormatState { 262 struct ApmFormatState {
263 ApmFormatState() 263 ApmFormatState()
264 : // Format of processing streams at input/output call sites. 264 : // Format of processing streams at input/output call sites.
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 int delay_offset_ms; 306 int delay_offset_ms;
307 bool was_stream_delay_set; 307 bool was_stream_delay_set;
308 int last_stream_delay_ms; 308 int last_stream_delay_ms;
309 int last_aec_system_delay_ms; 309 int last_aec_system_delay_ms;
310 int stream_delay_jumps; 310 int stream_delay_jumps;
311 bool output_will_be_muted; 311 bool output_will_be_muted;
312 bool key_pressed; 312 bool key_pressed;
313 bool transient_suppressor_enabled; 313 bool transient_suppressor_enabled;
314 std::vector<Point> array_geometry; 314 std::vector<Point> array_geometry;
315 SphericalPointf target_direction; 315 SphericalPointf target_direction;
316 rtc::scoped_ptr<AudioBuffer> capture_audio; 316 std::unique_ptr<AudioBuffer> capture_audio;
317 // Only the rate and samples fields of fwd_proc_format_ are used because the 317 // Only the rate and samples fields of fwd_proc_format_ are used because the
318 // forward processing number of channels is mutable and is tracked by the 318 // forward processing number of channels is mutable and is tracked by the
319 // capture_audio_. 319 // capture_audio_.
320 StreamConfig fwd_proc_format; 320 StreamConfig fwd_proc_format;
321 int split_rate; 321 int split_rate;
322 } capture_ GUARDED_BY(crit_capture_); 322 } capture_ GUARDED_BY(crit_capture_);
323 323
324 struct ApmCaptureNonLockedState { 324 struct ApmCaptureNonLockedState {
325 ApmCaptureNonLockedState(bool beamformer_enabled) 325 ApmCaptureNonLockedState(bool beamformer_enabled)
326 : fwd_proc_format(kSampleRate16kHz), 326 : fwd_proc_format(kSampleRate16kHz),
327 split_rate(kSampleRate16kHz), 327 split_rate(kSampleRate16kHz),
328 stream_delay_ms(0), 328 stream_delay_ms(0),
329 beamformer_enabled(beamformer_enabled) {} 329 beamformer_enabled(beamformer_enabled) {}
330 // Only the rate and samples fields of fwd_proc_format_ are used because the 330 // Only the rate and samples fields of fwd_proc_format_ are used because the
331 // forward processing number of channels is mutable and is tracked by the 331 // forward processing number of channels is mutable and is tracked by the
332 // capture_audio_. 332 // capture_audio_.
333 StreamConfig fwd_proc_format; 333 StreamConfig fwd_proc_format;
334 int split_rate; 334 int split_rate;
335 int stream_delay_ms; 335 int stream_delay_ms;
336 bool beamformer_enabled; 336 bool beamformer_enabled;
337 } capture_nonlocked_; 337 } capture_nonlocked_;
338 338
339 struct ApmRenderState { 339 struct ApmRenderState {
340 rtc::scoped_ptr<AudioConverter> render_converter; 340 std::unique_ptr<AudioConverter> render_converter;
341 rtc::scoped_ptr<AudioBuffer> render_audio; 341 std::unique_ptr<AudioBuffer> render_audio;
342 } render_ GUARDED_BY(crit_render_); 342 } render_ GUARDED_BY(crit_render_);
343 }; 343 };
344 344
345 } // namespace webrtc 345 } // namespace webrtc
346 346
347 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_AUDIO_PROCESSING_IMPL_H_ 347 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_AUDIO_PROCESSING_IMPL_H_
OLDNEW
« no previous file with comments | « webrtc/modules/audio_processing/audio_buffer.h ('k') | webrtc/modules/audio_processing/audio_processing_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698