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 // AudioOutputDispatcher is a single-threaded base class that dispatches | 5 // AudioOutputDispatcher is a single-threaded base class that dispatches |
| 6 // creation and deletion of audio output streams. AudioOutputProxy objects use | 6 // creation and deletion of audio output streams. AudioOutputProxy objects use |
| 7 // this class to allocate and recycle actual audio output streams. When playback | 7 // this class to allocate and recycle actual audio output streams. When playback |
| 8 // is started, the proxy calls StartStream() to get an output stream that it | 8 // is started, the proxy calls StartStream() to get an output stream that it |
| 9 // uses to play audio. When playback is stopped, the proxy returns the stream | 9 // uses to play audio. When playback is stopped, the proxy returns the stream |
| 10 // back to the dispatcher by calling StopStream(). | 10 // back to the dispatcher by calling StopStream(). |
| 11 // | 11 // |
| 12 // AudioManagerBase creates one specialization of AudioOutputDispatcher on the | 12 // AudioManagerBase creates one specialization of AudioOutputDispatcher on the |
| 13 // audio thread for each possible set of audio parameters. I.e streams with | 13 // audio thread for each possible set of audio parameters. I.e streams with |
| 14 // different parameters are managed independently. The AudioOutputDispatcher | 14 // different parameters are managed independently. The AudioOutputDispatcher |
| 15 // instance is then deleted on the audio thread when the AudioManager shuts | 15 // instance is then deleted on the audio thread when the AudioManager shuts |
| 16 // down. | 16 // down. |
| 17 | 17 |
| 18 #ifndef MEDIA_AUDIO_AUDIO_OUTPUT_DISPATCHER_H_ | 18 #ifndef MEDIA_AUDIO_AUDIO_OUTPUT_DISPATCHER_H_ |
| 19 #define MEDIA_AUDIO_AUDIO_OUTPUT_DISPATCHER_H_ | 19 #define MEDIA_AUDIO_AUDIO_OUTPUT_DISPATCHER_H_ |
| 20 | 20 |
| 21 #include "base/macros.h" | 21 #include "base/macros.h" |
| 22 #include "base/memory/weak_ptr.h" | |
| 22 #include "media/audio/audio_io.h" | 23 #include "media/audio/audio_io.h" |
| 23 #include "media/audio/audio_manager.h" | 24 #include "media/audio/audio_manager.h" |
| 24 #include "media/base/audio_parameters.h" | 25 #include "media/base/audio_parameters.h" |
| 25 | 26 |
| 26 namespace base { | 27 namespace base { |
| 27 class SingleThreadTaskRunner; | 28 class SingleThreadTaskRunner; |
| 28 } | 29 } |
| 29 | 30 |
| 30 namespace media { | 31 namespace media { |
| 31 | 32 |
| 32 class AudioOutputProxy; | 33 class AudioOutputProxy; |
| 33 | 34 |
| 34 class MEDIA_EXPORT AudioOutputDispatcher { | 35 class MEDIA_EXPORT AudioOutputDispatcher |
| 36 : public base::SupportsWeakPtr<AudioOutputDispatcher> { | |
|
DaleCurtis
2017/01/10 20:54:40
Instead of adding this can you make the constructo
alokp
2017/01/10 22:51:26
A Create method will not work because AMB still ne
DaleCurtis
2017/01/10 22:58:08
what about AOD::CreateProxy() which returns an Aud
alokp
2017/01/10 23:31:53
Yes - this should work. Done.
| |
| 35 public: | 37 public: |
| 36 AudioOutputDispatcher(AudioManager* audio_manager, | 38 AudioOutputDispatcher(AudioManager* audio_manager, |
| 37 const AudioParameters& params, | 39 const AudioParameters& params, |
| 38 const std::string& device_id); | 40 const std::string& device_id); |
| 39 virtual ~AudioOutputDispatcher(); | 41 virtual ~AudioOutputDispatcher(); |
| 40 | 42 |
| 41 // Called by AudioOutputProxy to open the stream. | 43 // Called by AudioOutputProxy to open the stream. |
| 42 // Returns false, if it fails to open it. | 44 // Returns false, if it fails to open it. |
| 43 virtual bool OpenStream() = 0; | 45 virtual bool OpenStream() = 0; |
| 44 | 46 |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 70 const AudioParameters params_; | 72 const AudioParameters params_; |
| 71 std::string device_id_; | 73 std::string device_id_; |
| 72 | 74 |
| 73 private: | 75 private: |
| 74 DISALLOW_COPY_AND_ASSIGN(AudioOutputDispatcher); | 76 DISALLOW_COPY_AND_ASSIGN(AudioOutputDispatcher); |
| 75 }; | 77 }; |
| 76 | 78 |
| 77 } // namespace media | 79 } // namespace media |
| 78 | 80 |
| 79 #endif // MEDIA_AUDIO_AUDIO_OUTPUT_DISPATCHER_H_ | 81 #endif // MEDIA_AUDIO_AUDIO_OUTPUT_DISPATCHER_H_ |
| OLD | NEW |