OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // A fake implementation of AudioInputStream, useful for testing purpose. | 5 // A fake implementation of AudioInputStream, useful for testing purpose. |
6 | 6 |
7 #ifndef MEDIA_AUDIO_FAKE_AUDIO_INPUT_STREAM_H_ | 7 #ifndef MEDIA_AUDIO_FAKE_AUDIO_INPUT_STREAM_H_ |
8 #define MEDIA_AUDIO_FAKE_AUDIO_INOUT_STREAM_H_ | 8 #define MEDIA_AUDIO_FAKE_AUDIO_INOUT_STREAM_H_ |
9 | 9 |
10 #include <vector> | 10 #include <vector> |
(...skipping 12 matching lines...) Expand all Loading... |
23 static AudioInputStream* MakeFakeStream(AudioManagerBase* manager, | 23 static AudioInputStream* MakeFakeStream(AudioManagerBase* manager, |
24 const AudioParameters& params); | 24 const AudioParameters& params); |
25 | 25 |
26 virtual bool Open() OVERRIDE; | 26 virtual bool Open() OVERRIDE; |
27 virtual void Start(AudioInputCallback* callback) OVERRIDE; | 27 virtual void Start(AudioInputCallback* callback) OVERRIDE; |
28 virtual void Stop() OVERRIDE; | 28 virtual void Stop() OVERRIDE; |
29 virtual void Close() OVERRIDE; | 29 virtual void Close() OVERRIDE; |
30 virtual double GetMaxVolume() OVERRIDE; | 30 virtual double GetMaxVolume() OVERRIDE; |
31 virtual void SetVolume(double volume) OVERRIDE; | 31 virtual void SetVolume(double volume) OVERRIDE; |
32 virtual double GetVolume() OVERRIDE; | 32 virtual double GetVolume() OVERRIDE; |
| 33 virtual void SetAutomaticGainControl(bool enabled) OVERRIDE; |
| 34 virtual bool GetAutomaticGainControl() OVERRIDE; |
33 | 35 |
34 private: | 36 private: |
35 FakeAudioInputStream(AudioManagerBase* manager, | 37 FakeAudioInputStream(AudioManagerBase* manager, |
36 const AudioParameters& params); | 38 const AudioParameters& params); |
37 | 39 |
38 virtual ~FakeAudioInputStream(); | 40 virtual ~FakeAudioInputStream(); |
39 | 41 |
40 void DoCallback(); | 42 void DoCallback(); |
41 | 43 |
42 AudioManagerBase* audio_manager_; | 44 AudioManagerBase* audio_manager_; |
43 AudioInputCallback* callback_; | 45 AudioInputCallback* callback_; |
44 scoped_array<uint8> buffer_; | 46 scoped_array<uint8> buffer_; |
45 int buffer_size_; | 47 int buffer_size_; |
46 base::Thread thread_; | 48 base::Thread thread_; |
47 base::Time last_callback_time_; | 49 base::Time last_callback_time_; |
48 base::TimeDelta callback_interval_; | 50 base::TimeDelta callback_interval_; |
49 | 51 |
50 DISALLOW_COPY_AND_ASSIGN(FakeAudioInputStream); | 52 DISALLOW_COPY_AND_ASSIGN(FakeAudioInputStream); |
51 }; | 53 }; |
52 | 54 |
53 #endif // MEDIA_AUDIO_FAKE_AUDIO_INPUT_STREAM_H_ | 55 #endif // MEDIA_AUDIO_FAKE_AUDIO_INPUT_STREAM_H_ |
OLD | NEW |