Chromium Code Reviews| 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 #ifndef MEDIA_AUDIO_VIRTUAL_AUDIO_INPUT_STREAM_H_ | 5 #ifndef MEDIA_AUDIO_VIRTUAL_AUDIO_INPUT_STREAM_H_ |
| 6 #define MEDIA_AUDIO_VIRTUAL_AUDIO_INPUT_STREAM_H_ | 6 #define MEDIA_AUDIO_VIRTUAL_AUDIO_INPUT_STREAM_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 53 void Start(AudioInputCallback* callback) override; | 53 void Start(AudioInputCallback* callback) override; |
| 54 void Stop() override; | 54 void Stop() override; |
| 55 void Close() override; | 55 void Close() override; |
| 56 double GetMaxVolume() override; | 56 double GetMaxVolume() override; |
| 57 void SetVolume(double volume) override; | 57 void SetVolume(double volume) override; |
| 58 double GetVolume() override; | 58 double GetVolume() override; |
| 59 bool SetAutomaticGainControl(bool enabled) override; | 59 bool SetAutomaticGainControl(bool enabled) override; |
| 60 bool GetAutomaticGainControl() override; | 60 bool GetAutomaticGainControl() override; |
| 61 bool IsMuted() override; | 61 bool IsMuted() override; |
| 62 | 62 |
| 63 // Attaches a VirtualAudioOutputStream to be used as input. This | 63 // Attaches an AudioConverter::InputCallback to be used as input. This |
| 64 // VirtualAudioInputStream must outlive all attached streams, so any attached | 64 // VirtualAudioInputStream must outlive all attached streams, so any attached |
| 65 // stream must be closed (which causes a detach) before | 65 // stream must be closed (which causes a detach) before |
| 66 // VirtualAudioInputStream is destroyed. | 66 // VirtualAudioInputStream is destroyed. |
| 67 virtual void AddOutputStream(VirtualAudioOutputStream* stream, | 67 virtual void AddInputProvider(AudioConverter::InputCallback* input, |
| 68 const AudioParameters& output_params); | 68 const AudioParameters& params); |
| 69 | 69 |
| 70 // Detaches a VirtualAudioOutputStream and removes it as input. | 70 // Detaches an AudioConverter::InputCallback and removes it as input. |
| 71 virtual void RemoveOutputStream(VirtualAudioOutputStream* stream, | 71 virtual void RemoveInputProvider(AudioConverter::InputCallback* input, |
| 72 const AudioParameters& output_params); | 72 const AudioParameters& params); |
| 73 | |
| 74 // Returns the task runner that AudioInputCallback is running. | |
| 75 scoped_refptr<base::SingleThreadTaskRunner> GetTaskRunner() const; | |
|
miu
2016/05/28 02:45:00
Please remove this, since the data copying should
qiangchen
2016/05/31 21:17:33
Done.
| |
| 73 | 76 |
| 74 private: | 77 private: |
| 75 friend class VirtualAudioInputStreamTest; | 78 friend class VirtualAudioInputStreamTest; |
| 76 | 79 |
| 77 typedef std::map<AudioParameters, LoopbackAudioConverter*> AudioConvertersMap; | 80 typedef std::map<AudioParameters, LoopbackAudioConverter*> AudioConvertersMap; |
| 78 | 81 |
| 79 // Pulls audio data from all attached VirtualAudioOutputStreams, mixes and | 82 // Pulls audio data from all attached VirtualAudioOutputStreams, mixes and |
| 80 // converts the streams into one, and pushes the result to |callback_|. | 83 // converts the streams into one, and pushes the result to |callback_|. |
| 81 // Invoked on the worker thread. | 84 // Invoked on the worker thread. |
| 82 void PumpAudio(); | 85 void PumpAudio(); |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 111 std::unique_ptr<AudioBus> audio_bus_; | 114 std::unique_ptr<AudioBus> audio_bus_; |
| 112 | 115 |
| 113 base::ThreadChecker thread_checker_; | 116 base::ThreadChecker thread_checker_; |
| 114 | 117 |
| 115 DISALLOW_COPY_AND_ASSIGN(VirtualAudioInputStream); | 118 DISALLOW_COPY_AND_ASSIGN(VirtualAudioInputStream); |
| 116 }; | 119 }; |
| 117 | 120 |
| 118 } // namespace media | 121 } // namespace media |
| 119 | 122 |
| 120 #endif // MEDIA_AUDIO_VIRTUAL_AUDIO_INPUT_STREAM_H_ | 123 #endif // MEDIA_AUDIO_VIRTUAL_AUDIO_INPUT_STREAM_H_ |
| OLD | NEW |