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_INPUT_STREAM_H_ | 8 #define MEDIA_AUDIO_FAKE_AUDIO_INPUT_STREAM_H_ |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 // FakeVideoCaptureDevice is disconnected from an audio device. This means | 47 // FakeVideoCaptureDevice is disconnected from an audio device. This means |
48 // only one instance of this class gets to respond, which is okay because we | 48 // only one instance of this class gets to respond, which is okay because we |
49 // assume there's only one stream for this testing purpose. Furthermore this | 49 // assume there's only one stream for this testing purpose. Furthermore this |
50 // method will do nothing if --use-file-for-fake-audio-capture is specified | 50 // method will do nothing if --use-file-for-fake-audio-capture is specified |
51 // since the input stream will be playing from a file instead of beeping. | 51 // since the input stream will be playing from a file instead of beeping. |
52 // TODO(hclam): Make this non-static. To do this we'll need to fix | 52 // TODO(hclam): Make this non-static. To do this we'll need to fix |
53 // crbug.com/159053 such that video capture device is aware of audio | 53 // crbug.com/159053 such that video capture device is aware of audio |
54 // input stream. | 54 // input stream. |
55 static void BeepOnce(); | 55 static void BeepOnce(); |
56 | 56 |
| 57 // Set the muted state for _all_ FakeAudioInputStreams. The value is global, |
| 58 // so it can be set before any FakeAudioInputStreams have been created. |
| 59 static void SetGlobalMutedState(bool is_muted); |
| 60 |
57 private: | 61 private: |
58 FakeAudioInputStream(AudioManagerBase* manager, | 62 FakeAudioInputStream(AudioManagerBase* manager, |
59 const AudioParameters& params); | 63 const AudioParameters& params); |
60 ~FakeAudioInputStream() override; | 64 ~FakeAudioInputStream() override; |
61 | 65 |
62 std::unique_ptr<AudioOutputStream::AudioSourceCallback> ChooseSource(); | 66 std::unique_ptr<AudioOutputStream::AudioSourceCallback> ChooseSource(); |
63 void ReadAudioFromSource(); | 67 void ReadAudioFromSource(); |
64 | 68 |
65 AudioManagerBase* audio_manager_; | 69 AudioManagerBase* audio_manager_; |
66 AudioInputCallback* callback_; | 70 AudioInputCallback* callback_; |
67 FakeAudioWorker fake_audio_worker_; | 71 FakeAudioWorker fake_audio_worker_; |
68 AudioParameters params_; | 72 AudioParameters params_; |
69 | 73 |
70 std::unique_ptr<AudioOutputStream::AudioSourceCallback> audio_source_; | 74 std::unique_ptr<AudioOutputStream::AudioSourceCallback> audio_source_; |
71 std::unique_ptr<media::AudioBus> audio_bus_; | 75 std::unique_ptr<media::AudioBus> audio_bus_; |
72 | 76 |
73 DISALLOW_COPY_AND_ASSIGN(FakeAudioInputStream); | 77 DISALLOW_COPY_AND_ASSIGN(FakeAudioInputStream); |
74 }; | 78 }; |
75 | 79 |
76 } // namespace media | 80 } // namespace media |
77 | 81 |
78 #endif // MEDIA_AUDIO_FAKE_AUDIO_INPUT_STREAM_H_ | 82 #endif // MEDIA_AUDIO_FAKE_AUDIO_INPUT_STREAM_H_ |
OLD | NEW |