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

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

Issue 2427553003: Moved the AEC render sample queue into the audio processing module (Closed)
Patch Set: Rebase Created 4 years, 2 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
« no previous file with comments | « no previous file | webrtc/modules/audio_processing/audio_processing_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
11 #ifndef WEBRTC_MODULES_AUDIO_PROCESSING_AUDIO_PROCESSING_IMPL_H_ 11 #ifndef WEBRTC_MODULES_AUDIO_PROCESSING_AUDIO_PROCESSING_IMPL_H_
12 #define WEBRTC_MODULES_AUDIO_PROCESSING_AUDIO_PROCESSING_IMPL_H_ 12 #define WEBRTC_MODULES_AUDIO_PROCESSING_AUDIO_PROCESSING_IMPL_H_
13 13
14 #include <list> 14 #include <list>
15 #include <memory> 15 #include <memory>
16 #include <string> 16 #include <string>
17 #include <vector> 17 #include <vector>
18 18
19 #include "webrtc/base/criticalsection.h" 19 #include "webrtc/base/criticalsection.h"
20 #include "webrtc/base/gtest_prod_util.h" 20 #include "webrtc/base/gtest_prod_util.h"
21 #include "webrtc/base/ignore_wundef.h" 21 #include "webrtc/base/ignore_wundef.h"
22 #include "webrtc/base/swap_queue.h"
22 #include "webrtc/base/thread_annotations.h" 23 #include "webrtc/base/thread_annotations.h"
23 #include "webrtc/modules/audio_processing/audio_buffer.h" 24 #include "webrtc/modules/audio_processing/audio_buffer.h"
24 #include "webrtc/modules/audio_processing/include/audio_processing.h" 25 #include "webrtc/modules/audio_processing/include/audio_processing.h"
26 #include "webrtc/modules/audio_processing/render_queue_item_verifier.h"
25 #include "webrtc/system_wrappers/include/file_wrapper.h" 27 #include "webrtc/system_wrappers/include/file_wrapper.h"
26 28
27 #ifdef WEBRTC_AUDIOPROC_DEBUG_DUMP 29 #ifdef WEBRTC_AUDIOPROC_DEBUG_DUMP
28 // Files generated at build-time by the protobuf compiler. 30 // Files generated at build-time by the protobuf compiler.
29 RTC_PUSH_IGNORING_WUNDEF() 31 RTC_PUSH_IGNORING_WUNDEF()
30 #ifdef WEBRTC_ANDROID_PLATFORM_BUILD 32 #ifdef WEBRTC_ANDROID_PLATFORM_BUILD
31 #include "external/webrtc/webrtc/modules/audio_processing/debug.pb.h" 33 #include "external/webrtc/webrtc/modules/audio_processing/debug.pb.h"
32 #else 34 #else
33 #include "webrtc/modules/audio_processing/debug.pb.h" 35 #include "webrtc/modules/audio_processing/debug.pb.h"
34 #endif 36 #endif
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 void InitializeTransient() 228 void InitializeTransient()
227 EXCLUSIVE_LOCKS_REQUIRED(crit_render_, crit_capture_); 229 EXCLUSIVE_LOCKS_REQUIRED(crit_render_, crit_capture_);
228 void InitializeBeamformer() 230 void InitializeBeamformer()
229 EXCLUSIVE_LOCKS_REQUIRED(crit_render_, crit_capture_); 231 EXCLUSIVE_LOCKS_REQUIRED(crit_render_, crit_capture_);
230 void InitializeIntelligibility() 232 void InitializeIntelligibility()
231 EXCLUSIVE_LOCKS_REQUIRED(crit_render_, crit_capture_); 233 EXCLUSIVE_LOCKS_REQUIRED(crit_render_, crit_capture_);
232 int InitializeLocked(const ProcessingConfig& config) 234 int InitializeLocked(const ProcessingConfig& config)
233 EXCLUSIVE_LOCKS_REQUIRED(crit_render_, crit_capture_); 235 EXCLUSIVE_LOCKS_REQUIRED(crit_render_, crit_capture_);
234 void InitializeLevelController() EXCLUSIVE_LOCKS_REQUIRED(crit_capture_); 236 void InitializeLevelController() EXCLUSIVE_LOCKS_REQUIRED(crit_capture_);
235 237
238 void EmptyQueuedRenderAudio();
239 void AllocateRenderQueue()
240 EXCLUSIVE_LOCKS_REQUIRED(crit_render_, crit_capture_);
241 void QueueRenderAudio(const AudioBuffer* audio)
242 EXCLUSIVE_LOCKS_REQUIRED(crit_render_);
243
236 // Capture-side exclusive methods possibly running APM in a multi-threaded 244 // Capture-side exclusive methods possibly running APM in a multi-threaded
237 // manner that are called with the render lock already acquired. 245 // manner that are called with the render lock already acquired.
238 int ProcessCaptureStreamLocked() EXCLUSIVE_LOCKS_REQUIRED(crit_capture_); 246 int ProcessCaptureStreamLocked() EXCLUSIVE_LOCKS_REQUIRED(crit_capture_);
239 void MaybeUpdateHistograms() EXCLUSIVE_LOCKS_REQUIRED(crit_capture_); 247 void MaybeUpdateHistograms() EXCLUSIVE_LOCKS_REQUIRED(crit_capture_);
240 248
241 // Render-side exclusive methods possibly running APM in a multi-threaded 249 // Render-side exclusive methods possibly running APM in a multi-threaded
242 // manner that are called with the render lock already acquired. 250 // manner that are called with the render lock already acquired.
243 // TODO(ekm): Remove once all clients updated to new interface. 251 // TODO(ekm): Remove once all clients updated to new interface.
244 int AnalyzeReverseStreamLocked(const float* const* src, 252 int AnalyzeReverseStreamLocked(const float* const* src,
245 const StreamConfig& input_config, 253 const StreamConfig& input_config,
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 bool intelligibility_enabled; 363 bool intelligibility_enabled;
356 bool level_controller_enabled = false; 364 bool level_controller_enabled = false;
357 } capture_nonlocked_; 365 } capture_nonlocked_;
358 366
359 struct ApmRenderState { 367 struct ApmRenderState {
360 ApmRenderState(); 368 ApmRenderState();
361 ~ApmRenderState(); 369 ~ApmRenderState();
362 std::unique_ptr<AudioConverter> render_converter; 370 std::unique_ptr<AudioConverter> render_converter;
363 std::unique_ptr<AudioBuffer> render_audio; 371 std::unique_ptr<AudioBuffer> render_audio;
364 } render_ GUARDED_BY(crit_render_); 372 } render_ GUARDED_BY(crit_render_);
373
374 size_t render_queue_element_max_size_ GUARDED_BY(crit_render_)
375 GUARDED_BY(crit_capture_) = 0;
376 std::vector<float> render_queue_buffer_ GUARDED_BY(crit_render_);
377 std::vector<float> capture_queue_buffer_ GUARDED_BY(crit_capture_);
378
379 // Lock protection not needed.
380 std::unique_ptr<SwapQueue<std::vector<float>, RenderQueueItemVerifier<float>>>
381 render_signal_queue_;
365 }; 382 };
366 383
367 } // namespace webrtc 384 } // namespace webrtc
368 385
369 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_AUDIO_PROCESSING_IMPL_H_ 386 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_AUDIO_PROCESSING_IMPL_H_
OLDNEW
« no previous file with comments | « no previous file | webrtc/modules/audio_processing/audio_processing_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698