OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef COMPONENTS_COPRESENCE_COMMON_AUDIO_TEST_SUPPORT_ | 5 #ifndef COMPONENTS_COPRESENCE_COMMON_AUDIO_TEST_SUPPORT_ |
6 #define COMPONENTS_COPRESENCE_COMMON_AUDIO_TEST_SUPPORT_ | 6 #define COMPONENTS_COPRESENCE_COMMON_AUDIO_TEST_SUPPORT_ |
7 | 7 |
8 #include <cstddef> | 8 #include <cstddef> |
9 | 9 |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "components/copresence/mediums/audio/audio_player.h" | |
13 #include "components/copresence/mediums/audio/audio_recorder.h" | |
12 | 14 |
13 namespace media { | 15 namespace media { |
14 class AudioBus; | 16 class AudioBus; |
15 class AudioBusRefCounted; | 17 class AudioBusRefCounted; |
16 } | 18 } |
17 | 19 |
18 namespace copresence { | 20 namespace copresence { |
19 | 21 |
20 // Populate random samples given a random seed into the samples array. | 22 // Populate random samples given a random seed into the samples array. |
21 void PopulateSamples(int random_seed, size_t size, float* samples); | 23 void PopulateSamples(int random_seed, size_t size, float* samples); |
22 | 24 |
23 // Create an audio bus populated with random samples. | 25 // Create an audio bus populated with random samples. |
24 scoped_ptr<media::AudioBus> CreateRandomAudio(int random_seed, | 26 scoped_ptr<media::AudioBus> CreateRandomAudio(int random_seed, |
25 int channels, | 27 int channels, |
26 int samples); | 28 int samples); |
27 | 29 |
28 // Create an ref counted audio bus populated with random samples. | 30 // Create an ref counted audio bus populated with random samples. |
29 scoped_refptr<media::AudioBusRefCounted> | 31 scoped_refptr<media::AudioBusRefCounted> |
30 CreateRandomAudioRefCounted(int random_seed, int channels, int samples); | 32 CreateRandomAudioRefCounted(int random_seed, int channels, int samples); |
31 | 33 |
34 class TestAudioPlayer : public AudioPlayer { | |
Daniel Erat
2014/10/21 19:43:22
i think that names like AudioPlayerStub and AudioR
rkc
2014/10/22 00:06:20
Done.
| |
35 public: | |
36 TestAudioPlayer(); | |
37 virtual ~TestAudioPlayer(); | |
38 | |
39 // AudioPlayer overrides: | |
40 virtual void Initialize() override; | |
41 virtual void Play( | |
42 const scoped_refptr<media::AudioBusRefCounted>& samples) override; | |
43 virtual void Stop() override; | |
44 virtual void Finalize() override; | |
45 virtual bool IsPlaying() override; | |
46 | |
47 private: | |
48 bool is_playing_; | |
49 DISALLOW_COPY_AND_ASSIGN(TestAudioPlayer); | |
50 }; | |
51 | |
52 class TestAudioRecorder : public AudioRecorderImpl { | |
Daniel Erat
2014/10/21 19:43:23
why's this deriving from AudioRecorderImpl instead
rkc
2014/10/22 00:06:20
All derived classes marked final.
Done.
| |
53 public: | |
54 TestAudioRecorder(); | |
55 virtual ~TestAudioRecorder(); | |
56 | |
57 // AudioRecorder overrides: | |
58 virtual void Initialize(const RecordedSamplesCallback& cb) override; | |
59 virtual void Record() override; | |
60 virtual void Stop() override; | |
61 virtual void Finalize() override; | |
62 virtual bool IsRecording() override; | |
63 | |
64 void TriggerDecodeRequest(); | |
65 | |
66 private: | |
67 RecordedSamplesCallback cb_; | |
68 bool is_recording_; | |
69 | |
70 DISALLOW_COPY_AND_ASSIGN(TestAudioRecorder); | |
71 }; | |
72 | |
32 } // namespace copresence | 73 } // namespace copresence |
33 | 74 |
34 #endif // COMPONENTS_COPRESENCE_COMMON_AUDIO_TEST_SUPPORT_ | 75 #endif // COMPONENTS_COPRESENCE_COMMON_AUDIO_TEST_SUPPORT_ |
OLD | NEW |