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/atomic_ref_count.h" | 8 #include "base/atomic_ref_count.h" |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/cancelable_callback.h" | 10 #include "base/cancelable_callback.h" |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 // now that it can handle synchronized I/O. | 84 // now that it can handle synchronized I/O. |
85 class SyncReader { | 85 class SyncReader { |
86 public: | 86 public: |
87 virtual ~SyncReader() {} | 87 virtual ~SyncReader() {} |
88 | 88 |
89 // Notify the synchronous reader the number of bytes in the | 89 // Notify the synchronous reader the number of bytes in the |
90 // AudioOutputController not yet played. This is used by SyncReader to | 90 // AudioOutputController not yet played. This is used by SyncReader to |
91 // prepare more data and perform synchronization. | 91 // prepare more data and perform synchronization. |
92 virtual void UpdatePendingBytes(uint32 bytes) = 0; | 92 virtual void UpdatePendingBytes(uint32 bytes) = 0; |
93 | 93 |
94 // Attempt to completely fill |dest|, return the actual number of frames | 94 // Attempts to completely fill |dest|, zeroing |dest| if the request can not |
95 // that could be read. |source| may optionally be provided for input data. | 95 // be fulfilled (due to timeout). |source| may optionally be provided for |
96 // If |block| is specified, the Read() will block until data is available | 96 // input data. |
97 // or a timeout is reached. | 97 virtual void Read(const AudioBus* source, AudioBus* dest) = 0; |
98 virtual int Read(bool block, const AudioBus* source, AudioBus* dest) = 0; | |
99 | 98 |
100 // Close this synchronous reader. | 99 // Close this synchronous reader. |
101 virtual void Close() = 0; | 100 virtual void Close() = 0; |
102 }; | 101 }; |
103 | 102 |
104 // Factory method for creating an AudioOutputController. | 103 // Factory method for creating an AudioOutputController. |
105 // This also creates and opens an AudioOutputStream on the audio manager | 104 // This also creates and opens an AudioOutputStream on the audio manager |
106 // thread, and if this is successful, the |event_handler| will receive an | 105 // thread, and if this is successful, the |event_handler| will receive an |
107 // OnCreated() call from the same audio manager thread. |audio_manager| must | 106 // OnCreated() call from the same audio manager thread. |audio_manager| must |
108 // outlive AudioOutputController. | 107 // outlive AudioOutputController. |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 // When starting stream we wait for data to become available. | 251 // When starting stream we wait for data to become available. |
253 // Number of times left. | 252 // Number of times left. |
254 int number_polling_attempts_left_; | 253 int number_polling_attempts_left_; |
255 | 254 |
256 DISALLOW_COPY_AND_ASSIGN(AudioOutputController); | 255 DISALLOW_COPY_AND_ASSIGN(AudioOutputController); |
257 }; | 256 }; |
258 | 257 |
259 } // namespace media | 258 } // namespace media |
260 | 259 |
261 #endif // MEDIA_AUDIO_AUDIO_OUTPUT_CONTROLLER_H_ | 260 #endif // MEDIA_AUDIO_AUDIO_OUTPUT_CONTROLLER_H_ |
OLD | NEW |