| 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(). |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 | 31 |
| 32 namespace media { | 32 namespace media { |
| 33 | 33 |
| 34 class AudioOutputProxy; | 34 class AudioOutputProxy; |
| 35 | 35 |
| 36 class MEDIA_EXPORT AudioOutputDispatcher | 36 class MEDIA_EXPORT AudioOutputDispatcher |
| 37 : public base::RefCountedThreadSafe<AudioOutputDispatcher> { | 37 : public base::RefCountedThreadSafe<AudioOutputDispatcher> { |
| 38 public: | 38 public: |
| 39 AudioOutputDispatcher(AudioManager* audio_manager, | 39 AudioOutputDispatcher(AudioManager* audio_manager, |
| 40 const AudioParameters& params, | 40 const AudioParameters& params, |
| 41 const std::string& output_device_id, |
| 41 const std::string& input_device_id); | 42 const std::string& input_device_id); |
| 42 | 43 |
| 43 // Called by AudioOutputProxy to open the stream. | 44 // Called by AudioOutputProxy to open the stream. |
| 44 // Returns false, if it fails to open it. | 45 // Returns false, if it fails to open it. |
| 45 virtual bool OpenStream() = 0; | 46 virtual bool OpenStream() = 0; |
| 46 | 47 |
| 47 // Called by AudioOutputProxy when the stream is started. | 48 // Called by AudioOutputProxy when the stream is started. |
| 48 // Uses |callback| to get source data and report errors, if any. | 49 // Uses |callback| to get source data and report errors, if any. |
| 49 // Does *not* take ownership of this callback. | 50 // Does *not* take ownership of this callback. |
| 50 // Returns true if started successfully, false otherwise. | 51 // Returns true if started successfully, false otherwise. |
| (...skipping 21 matching lines...) Expand all Loading... |
| 72 friend class base::RefCountedThreadSafe<AudioOutputDispatcher>; | 73 friend class base::RefCountedThreadSafe<AudioOutputDispatcher>; |
| 73 friend class AudioOutputProxyTest; | 74 friend class AudioOutputProxyTest; |
| 74 | 75 |
| 75 virtual ~AudioOutputDispatcher(); | 76 virtual ~AudioOutputDispatcher(); |
| 76 | 77 |
| 77 // A no-reference-held pointer (we don't want circular references) back to the | 78 // A no-reference-held pointer (we don't want circular references) back to the |
| 78 // AudioManager that owns this object. | 79 // AudioManager that owns this object. |
| 79 AudioManager* audio_manager_; | 80 AudioManager* audio_manager_; |
| 80 base::MessageLoop* message_loop_; | 81 base::MessageLoop* message_loop_; |
| 81 AudioParameters params_; | 82 AudioParameters params_; |
| 83 const std::string output_device_id_; |
| 82 const std::string input_device_id_; | 84 const std::string input_device_id_; |
| 83 | 85 |
| 84 private: | 86 private: |
| 85 DISALLOW_COPY_AND_ASSIGN(AudioOutputDispatcher); | 87 DISALLOW_COPY_AND_ASSIGN(AudioOutputDispatcher); |
| 86 }; | 88 }; |
| 87 | 89 |
| 88 } // namespace media | 90 } // namespace media |
| 89 | 91 |
| 90 #endif // MEDIA_AUDIO_AUDIO_OUTPUT_DISPATCHER_H_ | 92 #endif // MEDIA_AUDIO_AUDIO_OUTPUT_DISPATCHER_H_ |
| OLD | NEW |