| 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 Config& config); | 45 explicit AudioProcessingImpl(const webrtc::Config& config); |
| 46 // AudioProcessingImpl takes ownership of beamformer. | 46 // AudioProcessingImpl takes ownership of beamformer. |
| 47 AudioProcessingImpl(const Config& config, NonlinearBeamformer* beamformer); | 47 AudioProcessingImpl(const webrtc::Config& config, |
| 48 NonlinearBeamformer* beamformer); |
| 48 ~AudioProcessingImpl() override; | 49 ~AudioProcessingImpl() override; |
| 49 int Initialize() override; | 50 int Initialize() override; |
| 50 int Initialize(int input_sample_rate_hz, | 51 int Initialize(int input_sample_rate_hz, |
| 51 int output_sample_rate_hz, | 52 int output_sample_rate_hz, |
| 52 int reverse_sample_rate_hz, | 53 int reverse_sample_rate_hz, |
| 53 ChannelLayout input_layout, | 54 ChannelLayout input_layout, |
| 54 ChannelLayout output_layout, | 55 ChannelLayout output_layout, |
| 55 ChannelLayout reverse_layout) override; | 56 ChannelLayout reverse_layout) override; |
| 56 int Initialize(const ProcessingConfig& processing_config) override; | 57 int Initialize(const ProcessingConfig& processing_config) override; |
| 57 void SetExtraOptions(const Config& config) override; | 58 void ApplyConfig(const AudioProcessing::Config& config) override; |
| 59 void SetExtraOptions(const webrtc::Config& config) override; |
| 58 void UpdateHistogramsOnCallEnd() override; | 60 void UpdateHistogramsOnCallEnd() override; |
| 59 int StartDebugRecording(const char filename[kMaxFilenameSize], | 61 int StartDebugRecording(const char filename[kMaxFilenameSize], |
| 60 int64_t max_log_size_bytes) override; | 62 int64_t max_log_size_bytes) override; |
| 61 int StartDebugRecording(FILE* handle, int64_t max_log_size_bytes) override; | 63 int StartDebugRecording(FILE* handle, int64_t max_log_size_bytes) override; |
| 62 | 64 |
| 63 int StartDebugRecordingForPlatformFile(rtc::PlatformFile handle) override; | 65 int StartDebugRecordingForPlatformFile(rtc::PlatformFile handle) override; |
| 64 int StopDebugRecording() override; | 66 int StopDebugRecording() override; |
| 65 | 67 |
| 66 // Capture-side exclusive methods possibly running APM in a | 68 // Capture-side exclusive methods possibly running APM in a |
| 67 // multi-threaded manner. Acquire the capture lock. | 69 // multi-threaded manner. Acquire the capture lock. |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 334 std::unique_ptr<AudioBuffer> capture_audio; | 336 std::unique_ptr<AudioBuffer> capture_audio; |
| 335 // Only the rate and samples fields of fwd_proc_format_ are used because the | 337 // Only the rate and samples fields of fwd_proc_format_ are used because the |
| 336 // forward processing number of channels is mutable and is tracked by the | 338 // forward processing number of channels is mutable and is tracked by the |
| 337 // capture_audio_. | 339 // capture_audio_. |
| 338 StreamConfig fwd_proc_format; | 340 StreamConfig fwd_proc_format; |
| 339 int split_rate; | 341 int split_rate; |
| 340 } capture_ GUARDED_BY(crit_capture_); | 342 } capture_ GUARDED_BY(crit_capture_); |
| 341 | 343 |
| 342 struct ApmCaptureNonLockedState { | 344 struct ApmCaptureNonLockedState { |
| 343 ApmCaptureNonLockedState(bool beamformer_enabled, | 345 ApmCaptureNonLockedState(bool beamformer_enabled, |
| 344 bool intelligibility_enabled, | 346 bool intelligibility_enabled) |
| 345 bool level_controller_enabled) | |
| 346 : fwd_proc_format(kSampleRate16kHz), | 347 : fwd_proc_format(kSampleRate16kHz), |
| 347 split_rate(kSampleRate16kHz), | 348 split_rate(kSampleRate16kHz), |
| 348 stream_delay_ms(0), | 349 stream_delay_ms(0), |
| 349 beamformer_enabled(beamformer_enabled), | 350 beamformer_enabled(beamformer_enabled), |
| 350 intelligibility_enabled(intelligibility_enabled), | 351 intelligibility_enabled(intelligibility_enabled) {} |
| 351 level_controller_enabled(level_controller_enabled) {} | |
| 352 // Only the rate and samples fields of fwd_proc_format_ are used because the | 352 // Only the rate and samples fields of fwd_proc_format_ are used because the |
| 353 // forward processing number of channels is mutable and is tracked by the | 353 // forward processing number of channels is mutable and is tracked by the |
| 354 // capture_audio_. | 354 // capture_audio_. |
| 355 StreamConfig fwd_proc_format; | 355 StreamConfig fwd_proc_format; |
| 356 int split_rate; | 356 int split_rate; |
| 357 int stream_delay_ms; | 357 int stream_delay_ms; |
| 358 bool beamformer_enabled; | 358 bool beamformer_enabled; |
| 359 bool intelligibility_enabled; | 359 bool intelligibility_enabled; |
| 360 bool level_controller_enabled; | 360 bool level_controller_enabled = false; |
| 361 } capture_nonlocked_; | 361 } capture_nonlocked_; |
| 362 | 362 |
| 363 struct ApmRenderState { | 363 struct ApmRenderState { |
| 364 ApmRenderState(); | 364 ApmRenderState(); |
| 365 ~ApmRenderState(); | 365 ~ApmRenderState(); |
| 366 std::unique_ptr<AudioConverter> render_converter; | 366 std::unique_ptr<AudioConverter> render_converter; |
| 367 std::unique_ptr<AudioBuffer> render_audio; | 367 std::unique_ptr<AudioBuffer> render_audio; |
| 368 } render_ GUARDED_BY(crit_render_); | 368 } render_ GUARDED_BY(crit_render_); |
| 369 }; | 369 }; |
| 370 | 370 |
| 371 } // namespace webrtc | 371 } // namespace webrtc |
| 372 | 372 |
| 373 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_AUDIO_PROCESSING_IMPL_H_ | 373 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_AUDIO_PROCESSING_IMPL_H_ |
| OLD | NEW |