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

Unified Diff: components/audio_modem/test/random_samples.cc

Issue 865483005: Creating the audio_modem component (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merging again Created 5 years, 10 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
« no previous file with comments | « components/audio_modem/test/random_samples.h ('k') | components/audio_modem/test/stub_whispernet_client.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/audio_modem/test/random_samples.cc
diff --git a/components/copresence/test/audio_test_support.cc b/components/audio_modem/test/random_samples.cc
similarity index 72%
rename from components/copresence/test/audio_test_support.cc
rename to components/audio_modem/test/random_samples.cc
index 5dd8966896c1867eba6fa4da2d86654415b1ea47..815beaa24de1904af8f5379ba45c072bc2f7e5d4 100644
--- a/components/copresence/test/audio_test_support.cc
+++ b/components/audio_modem/test/random_samples.cc
@@ -1,20 +1,21 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "components/copresence/test/audio_test_support.h"
+#include "components/audio_modem/test/random_samples.h"
#include <cstdlib>
#include "media/base/audio_bus.h"
-namespace copresence {
+namespace audio_modem {
void PopulateSamples(unsigned int random_seed, size_t size, float* samples) {
+// On Windows, rand() is threadsafe, and rand_r() is not available.
#if defined(OS_WIN)
srand(random_seed);
for (size_t i = 0; i < size; ++i)
- samples[i] = (2.0 * rand() / RAND_MAX) - 1;
+ samples[i] = (2.0 * rand() / RAND_MAX) - 1; // NOLINT
#else
for (size_t i = 0; i < size; ++i)
samples[i] = (2.0 * rand_r(&random_seed) / RAND_MAX) - 1;
@@ -30,4 +31,4 @@ CreateRandomAudioRefCounted(int random_seed, int channels, int samples) {
return bus;
}
-} // namespace copresence
+} // namespace audio_modem
« no previous file with comments | « components/audio_modem/test/random_samples.h ('k') | components/audio_modem/test/stub_whispernet_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698