| 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 24 matching lines...) Expand all Loading... |
| 35 | 35 |
| 36 class AgcManagerDirect; | 36 class AgcManagerDirect; |
| 37 class AudioConverter; | 37 class AudioConverter; |
| 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 webrtc::Config& config); | 45 explicit AudioProcessingImpl(const Config& config); |
| 46 // AudioProcessingImpl takes ownership of beamformer. | 46 // AudioProcessingImpl takes ownership of beamformer. |
| 47 AudioProcessingImpl(const webrtc::Config& config, | 47 AudioProcessingImpl(const Config& config, NonlinearBeamformer* beamformer); |
| 48 NonlinearBeamformer* beamformer); | |
| 49 ~AudioProcessingImpl() override; | 48 ~AudioProcessingImpl() override; |
| 50 int Initialize() override; | 49 int Initialize() override; |
| 51 int Initialize(int input_sample_rate_hz, | 50 int Initialize(int input_sample_rate_hz, |
| 52 int output_sample_rate_hz, | 51 int output_sample_rate_hz, |
| 53 int reverse_sample_rate_hz, | 52 int reverse_sample_rate_hz, |
| 54 ChannelLayout input_layout, | 53 ChannelLayout input_layout, |
| 55 ChannelLayout output_layout, | 54 ChannelLayout output_layout, |
| 56 ChannelLayout reverse_layout) override; | 55 ChannelLayout reverse_layout) override; |
| 57 int Initialize(const ProcessingConfig& processing_config) override; | 56 int Initialize(const ProcessingConfig& processing_config) override; |
| 58 void ApplyConfig(const AudioProcessing::Config& config) override; | 57 void SetExtraOptions(const Config& config) override; |
| 59 void SetExtraOptions(const webrtc::Config& config) override; | |
| 60 void UpdateHistogramsOnCallEnd() override; | 58 void UpdateHistogramsOnCallEnd() override; |
| 61 int StartDebugRecording(const char filename[kMaxFilenameSize], | 59 int StartDebugRecording(const char filename[kMaxFilenameSize], |
| 62 int64_t max_log_size_bytes) override; | 60 int64_t max_log_size_bytes) override; |
| 63 int StartDebugRecording(FILE* handle, int64_t max_log_size_bytes) override; | 61 int StartDebugRecording(FILE* handle, int64_t max_log_size_bytes) override; |
| 64 | 62 |
| 65 int StartDebugRecordingForPlatformFile(rtc::PlatformFile handle) override; | 63 int StartDebugRecordingForPlatformFile(rtc::PlatformFile handle) override; |
| 66 int StopDebugRecording() override; | 64 int StopDebugRecording() override; |
| 67 | 65 |
| 68 // Capture-side exclusive methods possibly running APM in a | 66 // Capture-side exclusive methods possibly running APM in a |
| 69 // multi-threaded manner. Acquire the capture lock. | 67 // multi-threaded manner. Acquire the capture lock. |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 std::unique_ptr<AudioBuffer> capture_audio; | 305 std::unique_ptr<AudioBuffer> capture_audio; |
| 308 // Only the rate and samples fields of fwd_proc_format_ are used because the | 306 // Only the rate and samples fields of fwd_proc_format_ are used because the |
| 309 // forward processing number of channels is mutable and is tracked by the | 307 // forward processing number of channels is mutable and is tracked by the |
| 310 // capture_audio_. | 308 // capture_audio_. |
| 311 StreamConfig fwd_proc_format; | 309 StreamConfig fwd_proc_format; |
| 312 int split_rate; | 310 int split_rate; |
| 313 } capture_ GUARDED_BY(crit_capture_); | 311 } capture_ GUARDED_BY(crit_capture_); |
| 314 | 312 |
| 315 struct ApmCaptureNonLockedState { | 313 struct ApmCaptureNonLockedState { |
| 316 ApmCaptureNonLockedState(bool beamformer_enabled, | 314 ApmCaptureNonLockedState(bool beamformer_enabled, |
| 317 bool intelligibility_enabled) | 315 bool intelligibility_enabled, |
| 316 bool level_controller_enabled) |
| 318 : fwd_proc_format(kSampleRate16kHz), | 317 : fwd_proc_format(kSampleRate16kHz), |
| 319 split_rate(kSampleRate16kHz), | 318 split_rate(kSampleRate16kHz), |
| 320 stream_delay_ms(0), | 319 stream_delay_ms(0), |
| 321 beamformer_enabled(beamformer_enabled), | 320 beamformer_enabled(beamformer_enabled), |
| 322 intelligibility_enabled(intelligibility_enabled) {} | 321 intelligibility_enabled(intelligibility_enabled), |
| 322 level_controller_enabled(level_controller_enabled) {} |
| 323 // Only the rate and samples fields of fwd_proc_format_ are used because the | 323 // Only the rate and samples fields of fwd_proc_format_ are used because the |
| 324 // forward processing number of channels is mutable and is tracked by the | 324 // forward processing number of channels is mutable and is tracked by the |
| 325 // capture_audio_. | 325 // capture_audio_. |
| 326 StreamConfig fwd_proc_format; | 326 StreamConfig fwd_proc_format; |
| 327 int split_rate; | 327 int split_rate; |
| 328 int stream_delay_ms; | 328 int stream_delay_ms; |
| 329 bool beamformer_enabled; | 329 bool beamformer_enabled; |
| 330 bool intelligibility_enabled; | 330 bool intelligibility_enabled; |
| 331 bool level_controller_enabled = false; | 331 bool level_controller_enabled; |
| 332 } capture_nonlocked_; | 332 } capture_nonlocked_; |
| 333 | 333 |
| 334 struct ApmRenderState { | 334 struct ApmRenderState { |
| 335 ApmRenderState(); | 335 ApmRenderState(); |
| 336 ~ApmRenderState(); | 336 ~ApmRenderState(); |
| 337 std::unique_ptr<AudioConverter> render_converter; | 337 std::unique_ptr<AudioConverter> render_converter; |
| 338 std::unique_ptr<AudioBuffer> render_audio; | 338 std::unique_ptr<AudioBuffer> render_audio; |
| 339 } render_ GUARDED_BY(crit_render_); | 339 } render_ GUARDED_BY(crit_render_); |
| 340 }; | 340 }; |
| 341 | 341 |
| 342 } // namespace webrtc | 342 } // namespace webrtc |
| 343 | 343 |
| 344 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_AUDIO_PROCESSING_IMPL_H_ | 344 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_AUDIO_PROCESSING_IMPL_H_ |
| OLD | NEW |