Chromium Code Reviews| Index: media/audio/fake_audio_input_stream.h |
| diff --git a/media/audio/fake_audio_input_stream.h b/media/audio/fake_audio_input_stream.h |
| index 5f9f804ababa7d3279d930676d6afd267f7d2cd5..165d1a1b6bac76a01d0a87757e4583871334dea2 100644 |
| --- a/media/audio/fake_audio_input_stream.h |
| +++ b/media/audio/fake_audio_input_stream.h |
| @@ -9,23 +9,26 @@ |
| #include <vector> |
| +#include "base/files/file_path.h" |
| #include "base/memory/scoped_ptr.h" |
| #include "base/synchronization/lock.h" |
| #include "base/threading/thread.h" |
| #include "base/time/time.h" |
| #include "media/audio/audio_io.h" |
| #include "media/audio/audio_parameters.h" |
| +#include "media/audio/sounds/wav_audio_handler.h" |
| namespace media { |
| class AudioBus; |
| class AudioManagerBase; |
| +// This class can either generate a beep sound or play audio from a file. |
| class MEDIA_EXPORT FakeAudioInputStream |
| : public AudioInputStream { |
| public: |
| - static AudioInputStream* MakeFakeStream(AudioManagerBase* manager, |
| - const AudioParameters& params); |
| + static AudioInputStream* MakeFakeStream( |
| + AudioManagerBase* manager, const AudioParameters& params); |
| bool Open() override; |
| void Start(AudioInputCallback* callback) override; |
| @@ -52,14 +55,22 @@ class MEDIA_EXPORT FakeAudioInputStream |
| private: |
| FakeAudioInputStream(AudioManagerBase* manager, |
| const AudioParameters& params); |
| - |
| ~FakeAudioInputStream() override; |
| void DoCallback(); |
| + // Opens this stream reading from a |wav_filename| rather than beeping. |
| + void OpenInFileMode(const base::FilePath& wav_filename); |
| + |
| + // Returns true if the device is playing from a file; false if we're beeping. |
| + bool PlayingFromFile(); |
| + |
| + void PlayFileLooping(); |
| + void PlayBeep(); |
| + |
| AudioManagerBase* audio_manager_; |
| AudioInputCallback* callback_; |
| - scoped_ptr<uint8[]> buffer_; |
| + scoped_ptr<char[]> buffer_; |
|
phoglund_chromium
2014/11/18 12:30:42
This saves some casting.
|
| int buffer_size_; |
| AudioParameters params_; |
| const scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
| @@ -71,6 +82,9 @@ class MEDIA_EXPORT FakeAudioInputStream |
| int beep_period_in_frames_; |
| int frames_elapsed_; |
| scoped_ptr<media::AudioBus> audio_bus_; |
| + scoped_ptr<char[]> wav_file_data_; |
| + scoped_ptr<media::WavAudioHandler> wav_audio_handler_; |
| + int wav_file_read_pos_; |
| // Allows us to run tasks on the FakeAudioInputStream instance which are |
| // bound by its lifetime. |