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

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

Issue 2292863002: Introduced new scheme for controlling the functionality inside the audio processing module (Closed)
Patch Set: Changes in response to reviewer comments Created 4 years, 3 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
(...skipping 24 matching lines...) Expand all
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 virtual ~AudioProcessingImpl(); 49 virtual ~AudioProcessingImpl();
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 bool 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 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 std::unique_ptr<AudioBuffer> capture_audio; 317 std::unique_ptr<AudioBuffer> capture_audio;
316 // Only the rate and samples fields of fwd_proc_format_ are used because the 318 // Only the rate and samples fields of fwd_proc_format_ are used because the
317 // forward processing number of channels is mutable and is tracked by the 319 // forward processing number of channels is mutable and is tracked by the
318 // capture_audio_. 320 // capture_audio_.
319 StreamConfig fwd_proc_format; 321 StreamConfig fwd_proc_format;
320 int split_rate; 322 int split_rate;
321 } capture_ GUARDED_BY(crit_capture_); 323 } capture_ GUARDED_BY(crit_capture_);
322 324
323 struct ApmCaptureNonLockedState { 325 struct ApmCaptureNonLockedState {
324 ApmCaptureNonLockedState(bool beamformer_enabled, 326 ApmCaptureNonLockedState(bool beamformer_enabled,
325 bool intelligibility_enabled, 327 bool intelligibility_enabled)
326 bool level_controller_enabled)
327 : fwd_proc_format(kSampleRate16kHz), 328 : fwd_proc_format(kSampleRate16kHz),
328 split_rate(kSampleRate16kHz), 329 split_rate(kSampleRate16kHz),
329 stream_delay_ms(0), 330 stream_delay_ms(0),
330 beamformer_enabled(beamformer_enabled), 331 beamformer_enabled(beamformer_enabled),
331 intelligibility_enabled(intelligibility_enabled), 332 intelligibility_enabled(intelligibility_enabled) {}
332 level_controller_enabled(level_controller_enabled) {}
333 // Only the rate and samples fields of fwd_proc_format_ are used because the 333 // Only the rate and samples fields of fwd_proc_format_ are used because the
334 // forward processing number of channels is mutable and is tracked by the 334 // forward processing number of channels is mutable and is tracked by the
335 // capture_audio_. 335 // capture_audio_.
336 StreamConfig fwd_proc_format; 336 StreamConfig fwd_proc_format;
337 int split_rate; 337 int split_rate;
338 int stream_delay_ms; 338 int stream_delay_ms;
339 bool beamformer_enabled; 339 bool beamformer_enabled;
340 bool intelligibility_enabled; 340 bool intelligibility_enabled;
341 bool level_controller_enabled; 341 bool level_controller_enabled = false;
342 } capture_nonlocked_; 342 } capture_nonlocked_;
343 343
344 struct ApmRenderState { 344 struct ApmRenderState {
345 std::unique_ptr<AudioConverter> render_converter; 345 std::unique_ptr<AudioConverter> render_converter;
346 std::unique_ptr<AudioBuffer> render_audio; 346 std::unique_ptr<AudioBuffer> render_audio;
347 } render_ GUARDED_BY(crit_render_); 347 } render_ GUARDED_BY(crit_render_);
348 }; 348 };
349 349
350 } // namespace webrtc 350 } // namespace webrtc
351 351
352 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_AUDIO_PROCESSING_IMPL_H_ 352 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_AUDIO_PROCESSING_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698