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

Unified Diff: webrtc/modules/audio_processing/echo_control_mobile_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
Index: webrtc/modules/audio_processing/echo_control_mobile_impl.cc
diff --git a/webrtc/modules/audio_processing/echo_control_mobile_impl.cc b/webrtc/modules/audio_processing/echo_control_mobile_impl.cc
index b9e1e517c970de7709e7ff2744d4fed4b0623113..1233d6f769ac3d27229a1ae6c60059a8f32417c8 100644
--- a/webrtc/modules/audio_processing/echo_control_mobile_impl.cc
+++ b/webrtc/modules/audio_processing/echo_control_mobile_impl.cc
@@ -58,9 +58,6 @@ AudioProcessing::Error MapError(int err) {
}
} // namespace
-const size_t EchoControlMobileImpl::kAllowedValuesOfSamplesPerFrame1;
-const size_t EchoControlMobileImpl::kAllowedValuesOfSamplesPerFrame2;
-
size_t EchoControlMobile::echo_path_size_bytes() {
return WebRtcAecm_echo_path_size_bytes();
}
@@ -73,9 +70,7 @@ EchoControlMobileImpl::EchoControlMobileImpl(const AudioProcessing* apm,
routing_mode_(kSpeakerphone),
comfort_noise_enabled_(true),
external_echo_path_(NULL),
- render_queue_element_max_size_(0) {
- AllocateRenderQueue();
-}
+ render_queue_element_max_size_(0) {}
EchoControlMobileImpl::~EchoControlMobileImpl() {
if (external_echo_path_ != NULL) {
@@ -301,8 +296,9 @@ int EchoControlMobileImpl::Initialize() {
}
void EchoControlMobileImpl::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),
+ 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());
@@ -317,12 +313,12 @@ void EchoControlMobileImpl::AllocateRenderQueue() {
new SwapQueue<std::vector<int16_t>, RenderQueueItemVerifier<int16_t>>(
kMaxNumFramesToBuffer, template_queue_element,
RenderQueueItemVerifier<int16_t>(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* EchoControlMobileImpl::CreateHandle() const {

Powered by Google App Engine
This is Rietveld 408576698