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

Side by Side Diff: webrtc/modules/audio_processing/test/audio_processing_simulator.cc

Issue 2834643002: audioproc_f with simulated mic analog gain (Closed)
Patch Set: comments addressed Created 3 years, 7 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) 2016 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2016 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 #include "webrtc/modules/audio_processing/test/audio_processing_simulator.h" 11 #include "webrtc/modules/audio_processing/test/audio_processing_simulator.h"
12 12
13 #include <algorithm> 13 #include <algorithm>
14 #include <iostream> 14 #include <iostream>
15 #include <sstream> 15 #include <sstream>
16 #include <string> 16 #include <string>
17 #include <utility>
17 #include <vector> 18 #include <vector>
18 19
19 #include "webrtc/base/checks.h" 20 #include "webrtc/base/checks.h"
20 #include "webrtc/base/stringutils.h" 21 #include "webrtc/base/stringutils.h"
21 #include "webrtc/common_audio/include/audio_util.h" 22 #include "webrtc/common_audio/include/audio_util.h"
22 #include "webrtc/modules/audio_processing/include/audio_processing.h" 23 #include "webrtc/modules/audio_processing/include/audio_processing.h"
23 24
24 namespace webrtc { 25 namespace webrtc {
25 namespace test { 26 namespace test {
26 namespace { 27 namespace {
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 int64_t interval = rtc::TimeNanos() - start_time_; 100 int64_t interval = rtc::TimeNanos() - start_time_;
100 proc_time_->sum += interval; 101 proc_time_->sum += interval;
101 proc_time_->max = std::max(proc_time_->max, interval); 102 proc_time_->max = std::max(proc_time_->max, interval);
102 proc_time_->min = std::min(proc_time_->min, interval); 103 proc_time_->min = std::min(proc_time_->min, interval);
103 } 104 }
104 105
105 void AudioProcessingSimulator::ProcessStream(bool fixed_interface) { 106 void AudioProcessingSimulator::ProcessStream(bool fixed_interface) {
106 if (fixed_interface) { 107 if (fixed_interface) {
107 { 108 {
108 const auto st = ScopedTimer(mutable_proc_time()); 109 const auto st = ScopedTimer(mutable_proc_time());
110 // TODO(alessiob): Change fwd_frame_ simulating a mic with analog gain and
111 // an application gain.
109 RTC_CHECK_EQ(AudioProcessing::kNoError, ap_->ProcessStream(&fwd_frame_)); 112 RTC_CHECK_EQ(AudioProcessing::kNoError, ap_->ProcessStream(&fwd_frame_));
110 } 113 }
111 CopyFromAudioFrame(fwd_frame_, out_buf_.get()); 114 CopyFromAudioFrame(fwd_frame_, out_buf_.get());
112 } else { 115 } else {
113 const auto st = ScopedTimer(mutable_proc_time()); 116 const auto st = ScopedTimer(mutable_proc_time());
117 // TODO(alessiob): Change in_buf_->channels() simulating a mic with analog
118 // gain and an application gain.
114 RTC_CHECK_EQ(AudioProcessing::kNoError, 119 RTC_CHECK_EQ(AudioProcessing::kNoError,
115 ap_->ProcessStream(in_buf_->channels(), in_config_, 120 ap_->ProcessStream(in_buf_->channels(), in_config_,
116 out_config_, out_buf_->channels())); 121 out_config_, out_buf_->channels()));
117 } 122 }
118 123
119 if (buffer_writer_) { 124 if (buffer_writer_) {
120 buffer_writer_->Write(*out_buf_); 125 buffer_writer_->Write(*out_buf_);
121 } 126 }
122 127
123 if (residual_echo_likelihood_graph_writer_.is_open()) { 128 if (residual_echo_likelihood_graph_writer_.is_open()) {
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 size_t kMaxFilenameSize = AudioProcessing::kMaxFilenameSize; 393 size_t kMaxFilenameSize = AudioProcessing::kMaxFilenameSize;
389 RTC_CHECK_LE(settings_.aec_dump_output_filename->size(), kMaxFilenameSize); 394 RTC_CHECK_LE(settings_.aec_dump_output_filename->size(), kMaxFilenameSize);
390 RTC_CHECK_EQ(AudioProcessing::kNoError, 395 RTC_CHECK_EQ(AudioProcessing::kNoError,
391 ap_->StartDebugRecording( 396 ap_->StartDebugRecording(
392 settings_.aec_dump_output_filename->c_str(), -1)); 397 settings_.aec_dump_output_filename->c_str(), -1));
393 } 398 }
394 } 399 }
395 400
396 } // namespace test 401 } // namespace test
397 } // namespace webrtc 402 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698