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

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

Issue 1410833002: Lock scheme #4: Introduced the render sample queue for the aec and aecm (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@aec_error_report_CL
Patch Set: Merge with latest master Created 5 years, 1 month 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
11 #ifndef WEBRTC_MODULES_AUDIO_PROCESSING_ECHO_CANCELLATION_IMPL_H_ 11 #ifndef WEBRTC_MODULES_AUDIO_PROCESSING_ECHO_CANCELLATION_IMPL_H_
12 #define WEBRTC_MODULES_AUDIO_PROCESSING_ECHO_CANCELLATION_IMPL_H_ 12 #define WEBRTC_MODULES_AUDIO_PROCESSING_ECHO_CANCELLATION_IMPL_H_
13 13
14 #include "webrtc/base/scoped_ptr.h"
15 #include "webrtc/common_audio/swap_queue.h"
14 #include "webrtc/modules/audio_processing/include/audio_processing.h" 16 #include "webrtc/modules/audio_processing/include/audio_processing.h"
15 #include "webrtc/modules/audio_processing/processing_component.h" 17 #include "webrtc/modules/audio_processing/processing_component.h"
16 18
17 namespace webrtc { 19 namespace webrtc {
18 20
19 class AudioBuffer; 21 class AudioBuffer;
20 class CriticalSectionWrapper; 22 class CriticalSectionWrapper;
21 23
22 class EchoCancellationImpl : public EchoCancellation, 24 class EchoCancellationImpl : public EchoCancellation,
23 public ProcessingComponent { 25 public ProcessingComponent {
(...skipping 11 matching lines...) Expand all
35 SuppressionLevel suppression_level() const override; 37 SuppressionLevel suppression_level() const override;
36 bool is_drift_compensation_enabled() const override; 38 bool is_drift_compensation_enabled() const override;
37 39
38 // ProcessingComponent implementation. 40 // ProcessingComponent implementation.
39 int Initialize() override; 41 int Initialize() override;
40 void SetExtraOptions(const Config& config) override; 42 void SetExtraOptions(const Config& config) override;
41 43
42 bool is_delay_agnostic_enabled() const; 44 bool is_delay_agnostic_enabled() const;
43 bool is_extended_filter_enabled() const; 45 bool is_extended_filter_enabled() const;
44 46
47 // Reads render side data that has been queued on the render call.
48 void ReadQueuedRenderData();
49
45 private: 50 private:
51 static const size_t kAllowedValuesOfSamplesPerFrame1 = 80;
52 static const size_t kAllowedValuesOfSamplesPerFrame2 = 160;
53 // TODO(peah): Decrease this once we properly handle hugely unbalanced
54 // reverse and forward call numbers.
55 static const size_t kMaxNumFramesToBuffer = 100;
56
46 // EchoCancellation implementation. 57 // EchoCancellation implementation.
47 int Enable(bool enable) override; 58 int Enable(bool enable) override;
48 int enable_drift_compensation(bool enable) override; 59 int enable_drift_compensation(bool enable) override;
49 void set_stream_drift_samples(int drift) override; 60 void set_stream_drift_samples(int drift) override;
50 int set_suppression_level(SuppressionLevel level) override; 61 int set_suppression_level(SuppressionLevel level) override;
51 int enable_metrics(bool enable) override; 62 int enable_metrics(bool enable) override;
52 bool are_metrics_enabled() const override; 63 bool are_metrics_enabled() const override;
53 bool stream_has_echo() const override; 64 bool stream_has_echo() const override;
54 int GetMetrics(Metrics* metrics) override; 65 int GetMetrics(Metrics* metrics) override;
55 int enable_delay_logging(bool enable) override; 66 int enable_delay_logging(bool enable) override;
56 bool is_delay_logging_enabled() const override; 67 bool is_delay_logging_enabled() const override;
57 int GetDelayMetrics(int* median, int* std) override; 68 int GetDelayMetrics(int* median, int* std) override;
58 int GetDelayMetrics(int* median, 69 int GetDelayMetrics(int* median,
59 int* std, 70 int* std,
60 float* fraction_poor_delays) override; 71 float* fraction_poor_delays) override;
61 struct AecCore* aec_core() const override; 72 struct AecCore* aec_core() const override;
62 73
63 // ProcessingComponent implementation. 74 // ProcessingComponent implementation.
64 void* CreateHandle() const override; 75 void* CreateHandle() const override;
65 int InitializeHandle(void* handle) const override; 76 int InitializeHandle(void* handle) const override;
66 int ConfigureHandle(void* handle) const override; 77 int ConfigureHandle(void* handle) const override;
67 void DestroyHandle(void* handle) const override; 78 void DestroyHandle(void* handle) const override;
68 int num_handles_required() const override; 79 int num_handles_required() const override;
69 int GetHandleError(void* handle) const override; 80 int GetHandleError(void* handle) const override;
70 81
82 void AllocateRenderQueue();
83
71 const AudioProcessing* apm_; 84 const AudioProcessing* apm_;
72 CriticalSectionWrapper* crit_; 85 CriticalSectionWrapper* crit_;
73 bool drift_compensation_enabled_; 86 bool drift_compensation_enabled_;
74 bool metrics_enabled_; 87 bool metrics_enabled_;
75 SuppressionLevel suppression_level_; 88 SuppressionLevel suppression_level_;
76 int stream_drift_samples_; 89 int stream_drift_samples_;
77 bool was_stream_drift_set_; 90 bool was_stream_drift_set_;
78 bool stream_has_echo_; 91 bool stream_has_echo_;
79 bool delay_logging_enabled_; 92 bool delay_logging_enabled_;
80 bool extended_filter_enabled_; 93 bool extended_filter_enabled_;
81 bool delay_agnostic_enabled_; 94 bool delay_agnostic_enabled_;
95
96 size_t render_queue_element_max_size_;
97 std::vector<float> render_queue_buffer_;
98 std::vector<float> capture_queue_buffer_;
99 rtc::scoped_ptr<SwapQueue<std::vector<float>, RenderQueueItemVerifier<float>>>
100 render_signal_queue_;
82 }; 101 };
83 102
84 } // namespace webrtc 103 } // namespace webrtc
85 104
86 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_ECHO_CANCELLATION_IMPL_H_ 105 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_ECHO_CANCELLATION_IMPL_H_
OLDNEW
« no previous file with comments | « webrtc/modules/audio_processing/audio_processing_impl.cc ('k') | webrtc/modules/audio_processing/echo_cancellation_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698