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

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

Issue 2750783004: Add mute state field to AudioFrame. (Closed)
Patch Set: Update new usages of AudioFrame::data_ Created 3 years, 6 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
(...skipping 12 matching lines...) Expand all
23 23
24 namespace webrtc { 24 namespace webrtc {
25 namespace test { 25 namespace test {
26 namespace { 26 namespace {
27 27
28 void CopyFromAudioFrame(const AudioFrame& src, ChannelBuffer<float>* dest) { 28 void CopyFromAudioFrame(const AudioFrame& src, ChannelBuffer<float>* dest) {
29 RTC_CHECK_EQ(src.num_channels_, dest->num_channels()); 29 RTC_CHECK_EQ(src.num_channels_, dest->num_channels());
30 RTC_CHECK_EQ(src.samples_per_channel_, dest->num_frames()); 30 RTC_CHECK_EQ(src.samples_per_channel_, dest->num_frames());
31 // Copy the data from the input buffer. 31 // Copy the data from the input buffer.
32 std::vector<float> tmp(src.samples_per_channel_ * src.num_channels_); 32 std::vector<float> tmp(src.samples_per_channel_ * src.num_channels_);
33 S16ToFloat(src.data_, tmp.size(), tmp.data()); 33 S16ToFloat(src.data(), tmp.size(), tmp.data());
34 Deinterleave(tmp.data(), src.samples_per_channel_, src.num_channels_, 34 Deinterleave(tmp.data(), src.samples_per_channel_, src.num_channels_,
35 dest->channels()); 35 dest->channels());
36 } 36 }
37 37
38 std::string GetIndexedOutputWavFilename(const std::string& wav_name, 38 std::string GetIndexedOutputWavFilename(const std::string& wav_name,
39 int counter) { 39 int counter) {
40 std::stringstream ss; 40 std::stringstream ss;
41 ss << wav_name.substr(0, wav_name.size() - 4) << "_" << counter 41 ss << wav_name.substr(0, wav_name.size() - 4) << "_" << counter
42 << wav_name.substr(wav_name.size() - 4); 42 << wav_name.substr(wav_name.size() - 4);
43 return ss.str(); 43 return ss.str();
(...skipping 17 matching lines...) Expand all
61 61
62 } // namespace 62 } // namespace
63 63
64 SimulationSettings::SimulationSettings() = default; 64 SimulationSettings::SimulationSettings() = default;
65 SimulationSettings::SimulationSettings(const SimulationSettings&) = default; 65 SimulationSettings::SimulationSettings(const SimulationSettings&) = default;
66 SimulationSettings::~SimulationSettings() = default; 66 SimulationSettings::~SimulationSettings() = default;
67 67
68 void CopyToAudioFrame(const ChannelBuffer<float>& src, AudioFrame* dest) { 68 void CopyToAudioFrame(const ChannelBuffer<float>& src, AudioFrame* dest) {
69 RTC_CHECK_EQ(src.num_channels(), dest->num_channels_); 69 RTC_CHECK_EQ(src.num_channels(), dest->num_channels_);
70 RTC_CHECK_EQ(src.num_frames(), dest->samples_per_channel_); 70 RTC_CHECK_EQ(src.num_frames(), dest->samples_per_channel_);
71 int16_t* dest_data = dest->mutable_data();
71 for (size_t ch = 0; ch < dest->num_channels_; ++ch) { 72 for (size_t ch = 0; ch < dest->num_channels_; ++ch) {
72 for (size_t sample = 0; sample < dest->samples_per_channel_; ++sample) { 73 for (size_t sample = 0; sample < dest->samples_per_channel_; ++sample) {
73 dest->data_[sample * dest->num_channels_ + ch] = 74 dest_data[sample * dest->num_channels_ + ch] =
74 src.channels()[ch][sample] * 32767; 75 src.channels()[ch][sample] * 32767;
75 } 76 }
76 } 77 }
77 } 78 }
78 79
79 AudioProcessingSimulator::AudioProcessingSimulator( 80 AudioProcessingSimulator::AudioProcessingSimulator(
80 const SimulationSettings& settings) 81 const SimulationSettings& settings)
81 : settings_(settings) { 82 : settings_(settings) {
82 if (settings_.ed_graph_output_filename && 83 if (settings_.ed_graph_output_filename &&
83 settings_.ed_graph_output_filename->size() > 0) { 84 settings_.ed_graph_output_filename->size() > 0) {
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 size_t kMaxFilenameSize = AudioProcessing::kMaxFilenameSize; 392 size_t kMaxFilenameSize = AudioProcessing::kMaxFilenameSize;
392 RTC_CHECK_LE(settings_.aec_dump_output_filename->size(), kMaxFilenameSize); 393 RTC_CHECK_LE(settings_.aec_dump_output_filename->size(), kMaxFilenameSize);
393 RTC_CHECK_EQ(AudioProcessing::kNoError, 394 RTC_CHECK_EQ(AudioProcessing::kNoError,
394 ap_->StartDebugRecording( 395 ap_->StartDebugRecording(
395 settings_.aec_dump_output_filename->c_str(), -1)); 396 settings_.aec_dump_output_filename->c_str(), -1));
396 } 397 }
397 } 398 }
398 399
399 } // namespace test 400 } // namespace test
400 } // namespace webrtc 401 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/audio_processing/test/aec_dump_based_simulator.cc ('k') | webrtc/modules/include/module_common_types.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698