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

Unified Diff: webrtc/modules/audio_processing/test/audio_buffer_tools.cc

Issue 1783203002: Bitexactness test for the noise suppressor (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Fixed syntax error Created 4 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: webrtc/modules/audio_processing/test/audio_buffer_tools.cc
diff --git a/webrtc/modules/audio_processing/test/audio_buffer_tools.cc b/webrtc/modules/audio_processing/test/audio_buffer_tools.cc
index a8cb09ca6a4b7a3da898163b647c8d42e9ce7d5f..46ee61d71da9611e98844431989ea7f5cc48a889 100644
--- a/webrtc/modules/audio_processing/test/audio_buffer_tools.cc
+++ b/webrtc/modules/audio_processing/test/audio_buffer_tools.cc
@@ -10,10 +10,12 @@
#include "webrtc/modules/audio_processing/test/audio_buffer_tools.h"
+#include <string.h>
+
namespace webrtc {
namespace test {
-void SetupFrame(StreamConfig stream_config,
+void SetupFrame(const StreamConfig& stream_config,
std::vector<float*>* frame,
std::vector<float>* frame_samples) {
frame_samples->resize(stream_config.num_channels() *
@@ -25,30 +27,28 @@ void SetupFrame(StreamConfig stream_config,
}
void CopyVectorToAudioBuffer(const StreamConfig& stream_config,
- const std::vector<float>& source,
+ rtc::ArrayView<const float> source,
AudioBuffer* destination) {
std::vector<float*> input;
std::vector<float> input_samples;
SetupFrame(stream_config, &input, &input_samples);
- RTC_DCHECK_EQ(input_samples.size(), source.size());
- input_samples = source;
+ RTC_CHECK_EQ(input_samples.size(), source.size());
+ memcpy(input_samples.data(), source.data(),
+ source.size() * sizeof(source[0]));
destination->CopyFrom(&input[0], stream_config);
}
-std::vector<float> ExtractVectorFromAudioBuffer(
- const StreamConfig& stream_config,
- AudioBuffer* source) {
+void ExtractVectorFromAudioBuffer(const StreamConfig& stream_config,
+ AudioBuffer* source,
+ std::vector<float>* destination) {
std::vector<float*> output;
- std::vector<float> output_samples;
- SetupFrame(stream_config, &output, &output_samples);
+ SetupFrame(stream_config, &output, destination);
source->CopyTo(stream_config, &output[0]);
-
- return output_samples;
}
} // namespace test
« no previous file with comments | « webrtc/modules/audio_processing/test/audio_buffer_tools.h ('k') | webrtc/modules/audio_processing/test/bitexactness_tools.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698