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

Side by Side Diff: components/copresence/test/audio_test_support.cc

Issue 419073002: Add the copresence DirectiveHandler. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « components/copresence/test/audio_test_support.h ('k') | components/copresence/timed_map.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "components/copresence/test/audio_test_support.h"
6
7 #include <cstdlib>
8
9 #include "media/base/audio_bus.h"
10
11 namespace copresence {
12
13 void PopulateSamples(int random_seed, size_t size, float* samples) {
14 srand(random_seed);
15 for (size_t i = 0; i < size; ++i)
16 samples[i] = (2.0 * rand() / RAND_MAX) - 1;
17 }
18
19 scoped_ptr<media::AudioBus> CreateRandomAudio(int random_seed,
20 int channels,
21 int samples) {
22 scoped_ptr<media::AudioBus> bus = media::AudioBus::Create(channels, samples);
23 for (int ch = 0; ch < channels; ++ch)
24 PopulateSamples(random_seed, samples, bus->channel(ch));
25 return bus.Pass();
26 }
27
28 scoped_refptr<media::AudioBusRefCounted>
29 CreateRandomAudioRefCounted(int random_seed, int channels, int samples) {
30 scoped_refptr<media::AudioBusRefCounted> bus =
31 media::AudioBusRefCounted::Create(channels, samples);
32 for (int ch = 0; ch < channels; ++ch)
33 PopulateSamples(random_seed, samples, bus->channel(ch));
34 return bus;
35 }
36
37 } // namespace copresence
OLDNEW
« no previous file with comments | « components/copresence/test/audio_test_support.h ('k') | components/copresence/timed_map.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698