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

Unified Diff: webrtc/modules/audio_processing/echo_cancellation_impl.cc

Issue 1454683002: Fixed the render queue item size preallocation and verification, moved constant declarations, remov… (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | webrtc/modules/audio_processing/echo_control_mobile_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/modules/audio_processing/echo_cancellation_impl.cc
diff --git a/webrtc/modules/audio_processing/echo_cancellation_impl.cc b/webrtc/modules/audio_processing/echo_cancellation_impl.cc
index c6f92005a50f0fc4b5ded8226dd956fa726efced..d8de5d2b3b8dec81530d52817e66dcda158a750f 100644
--- a/webrtc/modules/audio_processing/echo_cancellation_impl.cc
+++ b/webrtc/modules/audio_processing/echo_cancellation_impl.cc
@@ -55,9 +55,6 @@ AudioProcessing::Error MapError(int err) {
}
} // namespace
-const size_t EchoCancellationImpl::kAllowedValuesOfSamplesPerFrame1;
-const size_t EchoCancellationImpl::kAllowedValuesOfSamplesPerFrame2;
-
EchoCancellationImpl::EchoCancellationImpl(const AudioProcessing* apm,
CriticalSectionWrapper* crit)
: ProcessingComponent(),
@@ -72,9 +69,7 @@ EchoCancellationImpl::EchoCancellationImpl(const AudioProcessing* apm,
delay_logging_enabled_(false),
extended_filter_enabled_(false),
delay_agnostic_enabled_(false),
- render_queue_element_max_size_(0) {
- AllocateRenderQueue();
-}
+ render_queue_element_max_size_(0) {}
EchoCancellationImpl::~EchoCancellationImpl() {}
@@ -384,8 +379,9 @@ int EchoCancellationImpl::Initialize() {
}
void EchoCancellationImpl::AllocateRenderQueue() {
- const size_t max_frame_size = std::max<size_t>(
- kAllowedValuesOfSamplesPerFrame1, kAllowedValuesOfSamplesPerFrame2);
+ const size_t max_frame_size =
+ std::max<size_t>(static_cast<size_t>(kAllowedValuesOfSamplesPerFrame1),
the sun 2015/11/17 13:44:37 It seems wasteful to me to do this at runtime. Why
peah-webrtc 2015/11/18 05:53:46 Good point! Done.
+ static_cast<size_t>(kAllowedValuesOfSamplesPerFrame2));
const size_t new_render_queue_element_max_size = std::max<size_t>(
static_cast<size_t>(1), max_frame_size * num_handles_required());
@@ -401,12 +397,12 @@ void EchoCancellationImpl::AllocateRenderQueue() {
new SwapQueue<std::vector<float>, RenderQueueItemVerifier<float>>(
kMaxNumFramesToBuffer, template_queue_element,
the sun 2015/11/17 13:44:37 Move kMaxNumFramesToBuffer into the anonymous name
peah-webrtc 2015/11/18 05:53:46 Done.
RenderQueueItemVerifier<float>(render_queue_element_max_size_)));
+
+ render_queue_buffer_.resize(render_queue_element_max_size_);
+ capture_queue_buffer_.resize(render_queue_element_max_size_);
} else {
render_signal_queue_->Clear();
}
-
- render_queue_buffer_.resize(new_render_queue_element_max_size);
- capture_queue_buffer_.resize(new_render_queue_element_max_size);
}
void EchoCancellationImpl::SetExtraOptions(const Config& config) {
« no previous file with comments | « no previous file | webrtc/modules/audio_processing/echo_control_mobile_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698