| OLD | NEW |
| 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 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 | 38 |
| 39 class NonlinearBeamformer; | 39 class NonlinearBeamformer; |
| 40 | 40 |
| 41 class AudioProcessingImpl : public AudioProcessing { | 41 class AudioProcessingImpl : public AudioProcessing { |
| 42 public: | 42 public: |
| 43 // Methods forcing APM to run in a single-threaded manner. | 43 // Methods forcing APM to run in a single-threaded manner. |
| 44 // Acquires both the render and capture locks. | 44 // Acquires both the render and capture locks. |
| 45 explicit AudioProcessingImpl(const Config& config); | 45 explicit AudioProcessingImpl(const Config& config); |
| 46 // AudioProcessingImpl takes ownership of beamformer. | 46 // AudioProcessingImpl takes ownership of beamformer. |
| 47 AudioProcessingImpl(const Config& config, NonlinearBeamformer* beamformer); | 47 AudioProcessingImpl(const Config& config, NonlinearBeamformer* beamformer); |
| 48 virtual ~AudioProcessingImpl(); | 48 ~AudioProcessingImpl() override; |
| 49 int Initialize() override; | 49 int Initialize() override; |
| 50 int Initialize(int input_sample_rate_hz, | 50 int Initialize(int input_sample_rate_hz, |
| 51 int output_sample_rate_hz, | 51 int output_sample_rate_hz, |
| 52 int reverse_sample_rate_hz, | 52 int reverse_sample_rate_hz, |
| 53 ChannelLayout input_layout, | 53 ChannelLayout input_layout, |
| 54 ChannelLayout output_layout, | 54 ChannelLayout output_layout, |
| 55 ChannelLayout reverse_layout) override; | 55 ChannelLayout reverse_layout) override; |
| 56 int Initialize(const ProcessingConfig& processing_config) override; | 56 int Initialize(const ProcessingConfig& processing_config) override; |
| 57 void SetExtraOptions(const Config& config) override; | 57 void SetExtraOptions(const Config& config) override; |
| 58 void UpdateHistogramsOnCallEnd() override; | 58 void UpdateHistogramsOnCallEnd() override; |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 virtual int InitializeLocked() | 126 virtual int InitializeLocked() |
| 127 EXCLUSIVE_LOCKS_REQUIRED(crit_render_, crit_capture_); | 127 EXCLUSIVE_LOCKS_REQUIRED(crit_render_, crit_capture_); |
| 128 | 128 |
| 129 private: | 129 private: |
| 130 struct ApmPublicSubmodules; | 130 struct ApmPublicSubmodules; |
| 131 struct ApmPrivateSubmodules; | 131 struct ApmPrivateSubmodules; |
| 132 | 132 |
| 133 #ifdef WEBRTC_AUDIOPROC_DEBUG_DUMP | 133 #ifdef WEBRTC_AUDIOPROC_DEBUG_DUMP |
| 134 // State for the debug dump. | 134 // State for the debug dump. |
| 135 struct ApmDebugDumpThreadState { | 135 struct ApmDebugDumpThreadState { |
| 136 ApmDebugDumpThreadState() : event_msg(new audioproc::Event()) {} | 136 ApmDebugDumpThreadState(); |
| 137 ~ApmDebugDumpThreadState(); |
| 137 std::unique_ptr<audioproc::Event> event_msg; // Protobuf message. | 138 std::unique_ptr<audioproc::Event> event_msg; // Protobuf message. |
| 138 std::string event_str; // Memory for protobuf serialization. | 139 std::string event_str; // Memory for protobuf serialization. |
| 139 | 140 |
| 140 // Serialized string of last saved APM configuration. | 141 // Serialized string of last saved APM configuration. |
| 141 std::string last_serialized_config; | 142 std::string last_serialized_config; |
| 142 }; | 143 }; |
| 143 | 144 |
| 144 struct ApmDebugDumpState { | 145 struct ApmDebugDumpState { |
| 145 ApmDebugDumpState() : debug_file(FileWrapper::Create()) {} | 146 ApmDebugDumpState(); |
| 147 ~ApmDebugDumpState(); |
| 146 // Number of bytes that can still be written to the log before the maximum | 148 // Number of bytes that can still be written to the log before the maximum |
| 147 // size is reached. A value of <= 0 indicates that no limit is used. | 149 // size is reached. A value of <= 0 indicates that no limit is used. |
| 148 int64_t num_bytes_left_for_log_ = -1; | 150 int64_t num_bytes_left_for_log_ = -1; |
| 149 std::unique_ptr<FileWrapper> debug_file; | 151 std::unique_ptr<FileWrapper> debug_file; |
| 150 ApmDebugDumpThreadState render; | 152 ApmDebugDumpThreadState render; |
| 151 ApmDebugDumpThreadState capture; | 153 ApmDebugDumpThreadState capture; |
| 152 }; | 154 }; |
| 153 #endif | 155 #endif |
| 154 | 156 |
| 155 // Method for modifying the formats struct that are called from both | 157 // Method for modifying the formats struct that are called from both |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 : // Format of processing streams at input/output call sites. | 282 : // Format of processing streams at input/output call sites. |
| 281 agc_startup_min_volume(agc_startup_min_volume), | 283 agc_startup_min_volume(agc_startup_min_volume), |
| 282 use_experimental_agc(use_experimental_agc) {} | 284 use_experimental_agc(use_experimental_agc) {} |
| 283 int agc_startup_min_volume; | 285 int agc_startup_min_volume; |
| 284 bool use_experimental_agc; | 286 bool use_experimental_agc; |
| 285 } constants_; | 287 } constants_; |
| 286 | 288 |
| 287 struct ApmCaptureState { | 289 struct ApmCaptureState { |
| 288 ApmCaptureState(bool transient_suppressor_enabled, | 290 ApmCaptureState(bool transient_suppressor_enabled, |
| 289 const std::vector<Point>& array_geometry, | 291 const std::vector<Point>& array_geometry, |
| 290 SphericalPointf target_direction) | 292 SphericalPointf target_direction); |
| 291 : aec_system_delay_jumps(-1), | 293 ~ApmCaptureState(); |
| 292 delay_offset_ms(0), | |
| 293 was_stream_delay_set(false), | |
| 294 last_stream_delay_ms(0), | |
| 295 last_aec_system_delay_ms(0), | |
| 296 stream_delay_jumps(-1), | |
| 297 output_will_be_muted(false), | |
| 298 key_pressed(false), | |
| 299 transient_suppressor_enabled(transient_suppressor_enabled), | |
| 300 array_geometry(array_geometry), | |
| 301 target_direction(target_direction), | |
| 302 fwd_proc_format(kSampleRate16kHz), | |
| 303 split_rate(kSampleRate16kHz) {} | |
| 304 int aec_system_delay_jumps; | 294 int aec_system_delay_jumps; |
| 305 int delay_offset_ms; | 295 int delay_offset_ms; |
| 306 bool was_stream_delay_set; | 296 bool was_stream_delay_set; |
| 307 int last_stream_delay_ms; | 297 int last_stream_delay_ms; |
| 308 int last_aec_system_delay_ms; | 298 int last_aec_system_delay_ms; |
| 309 int stream_delay_jumps; | 299 int stream_delay_jumps; |
| 310 bool output_will_be_muted; | 300 bool output_will_be_muted; |
| 311 bool key_pressed; | 301 bool key_pressed; |
| 312 bool transient_suppressor_enabled; | 302 bool transient_suppressor_enabled; |
| 313 std::vector<Point> array_geometry; | 303 std::vector<Point> array_geometry; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 335 // capture_audio_. | 325 // capture_audio_. |
| 336 StreamConfig fwd_proc_format; | 326 StreamConfig fwd_proc_format; |
| 337 int split_rate; | 327 int split_rate; |
| 338 int stream_delay_ms; | 328 int stream_delay_ms; |
| 339 bool beamformer_enabled; | 329 bool beamformer_enabled; |
| 340 bool intelligibility_enabled; | 330 bool intelligibility_enabled; |
| 341 bool level_controller_enabled; | 331 bool level_controller_enabled; |
| 342 } capture_nonlocked_; | 332 } capture_nonlocked_; |
| 343 | 333 |
| 344 struct ApmRenderState { | 334 struct ApmRenderState { |
| 335 ApmRenderState(); |
| 336 ~ApmRenderState(); |
| 345 std::unique_ptr<AudioConverter> render_converter; | 337 std::unique_ptr<AudioConverter> render_converter; |
| 346 std::unique_ptr<AudioBuffer> render_audio; | 338 std::unique_ptr<AudioBuffer> render_audio; |
| 347 } render_ GUARDED_BY(crit_render_); | 339 } render_ GUARDED_BY(crit_render_); |
| 348 }; | 340 }; |
| 349 | 341 |
| 350 } // namespace webrtc | 342 } // namespace webrtc |
| 351 | 343 |
| 352 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_AUDIO_PROCESSING_IMPL_H_ | 344 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_AUDIO_PROCESSING_IMPL_H_ |
| OLD | NEW |