| 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_AUDIO_OUTPUT_CONTROLLER_H_ | 5 #ifndef MEDIA_AUDIO_AUDIO_OUTPUT_CONTROLLER_H_ |
| 6 #define MEDIA_AUDIO_AUDIO_OUTPUT_CONTROLLER_H_ | 6 #define MEDIA_AUDIO_AUDIO_OUTPUT_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 virtual void UpdatePendingBytes(uint32 bytes) = 0; | 95 virtual void UpdatePendingBytes(uint32 bytes) = 0; |
| 96 | 96 |
| 97 // Attempt to completely fill |dest|, return the actual number of | 97 // Attempt to completely fill |dest|, return the actual number of |
| 98 // frames that could be read. | 98 // frames that could be read. |
| 99 // |source| may optionally be provided for input data. | 99 // |source| may optionally be provided for input data. |
| 100 virtual int Read(AudioBus* source, AudioBus* dest) = 0; | 100 virtual int Read(AudioBus* source, AudioBus* dest) = 0; |
| 101 | 101 |
| 102 // Close this synchronous reader. | 102 // Close this synchronous reader. |
| 103 virtual void Close() = 0; | 103 virtual void Close() = 0; |
| 104 | 104 |
| 105 // Poll if data is ready. | 105 // Check if data is ready. |
| 106 // Not reliable, as there is no guarantee that renderer is "new-style" | |
| 107 // renderer that writes metadata into buffer. After several unsuccessful | |
| 108 // attempts caller should assume the data is ready even if that function | |
| 109 // returns false. | |
| 110 virtual bool DataReady() = 0; | 106 virtual bool DataReady() = 0; |
| 111 }; | 107 }; |
| 112 | 108 |
| 113 // Factory method for creating an AudioOutputController. | 109 // Factory method for creating an AudioOutputController. |
| 114 // This also creates and opens an AudioOutputStream on the audio manager | 110 // This also creates and opens an AudioOutputStream on the audio manager |
| 115 // thread, and if this is successful, the |event_handler| will receive an | 111 // thread, and if this is successful, the |event_handler| will receive an |
| 116 // OnCreated() call from the same audio manager thread. |audio_manager| must | 112 // OnCreated() call from the same audio manager thread. |audio_manager| must |
| 117 // outlive AudioOutputController. | 113 // outlive AudioOutputController. |
| 118 static scoped_refptr<AudioOutputController> Create( | 114 static scoped_refptr<AudioOutputController> Create( |
| 119 AudioManager* audio_manager, EventHandler* event_handler, | 115 AudioManager* audio_manager, EventHandler* event_handler, |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 // shutdown and force it to wait for the most delayed task. | 231 // shutdown and force it to wait for the most delayed task. |
| 236 // Also, if we're shutting down, we do not want to poll for more data. | 232 // Also, if we're shutting down, we do not want to poll for more data. |
| 237 base::WeakPtrFactory<AudioOutputController> weak_this_; | 233 base::WeakPtrFactory<AudioOutputController> weak_this_; |
| 238 | 234 |
| 239 DISALLOW_COPY_AND_ASSIGN(AudioOutputController); | 235 DISALLOW_COPY_AND_ASSIGN(AudioOutputController); |
| 240 }; | 236 }; |
| 241 | 237 |
| 242 } // namespace media | 238 } // namespace media |
| 243 | 239 |
| 244 #endif // MEDIA_AUDIO_AUDIO_OUTPUT_CONTROLLER_H_ | 240 #endif // MEDIA_AUDIO_AUDIO_OUTPUT_CONTROLLER_H_ |
| OLD | NEW |