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 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 std::unique_ptr<AudioBuffer> capture_audio; | 307 std::unique_ptr<AudioBuffer> capture_audio; |
306 // Only the rate and samples fields of fwd_proc_format_ are used because the | 308 // Only the rate and samples fields of fwd_proc_format_ are used because the |
307 // forward processing number of channels is mutable and is tracked by the | 309 // forward processing number of channels is mutable and is tracked by the |
308 // capture_audio_. | 310 // capture_audio_. |
309 StreamConfig fwd_proc_format; | 311 StreamConfig fwd_proc_format; |
310 int split_rate; | 312 int split_rate; |
311 } capture_ GUARDED_BY(crit_capture_); | 313 } capture_ GUARDED_BY(crit_capture_); |
312 | 314 |
313 struct ApmCaptureNonLockedState { | 315 struct ApmCaptureNonLockedState { |
314 ApmCaptureNonLockedState(bool beamformer_enabled, | 316 ApmCaptureNonLockedState(bool beamformer_enabled, |
315 bool intelligibility_enabled, | 317 bool intelligibility_enabled) |
316 bool level_controller_enabled) | |
317 : fwd_proc_format(kSampleRate16kHz), | 318 : fwd_proc_format(kSampleRate16kHz), |
318 split_rate(kSampleRate16kHz), | 319 split_rate(kSampleRate16kHz), |
319 stream_delay_ms(0), | 320 stream_delay_ms(0), |
320 beamformer_enabled(beamformer_enabled), | 321 beamformer_enabled(beamformer_enabled), |
321 intelligibility_enabled(intelligibility_enabled), | 322 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; | 331 bool level_controller_enabled = false; |
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 |