OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 // Implementation notes: | 5 // Implementation notes: |
6 // | 6 // |
7 // - It is recommended to first acquire the native sample rate of the default | 7 // - It is recommended to first acquire the native sample rate of the default |
8 // output device and then use the same rate when creating this object. | 8 // output device and then use the same rate when creating this object. |
9 // Use AudioManagerMac::HardwareSampleRate() to retrieve the sample rate. | 9 // Use AudioManagerMac::HardwareSampleRate() to retrieve the sample rate. |
10 // - Calling Close() also leads to self destruction. | 10 // - Calling Close() also leads to self destruction. |
11 // - The latency consists of two parts: | 11 // - The latency consists of two parts: |
12 // 1) Hardware latency, which includes Audio Unit latency, audio device | 12 // 1) Hardware latency, which includes Audio Unit latency, audio device |
13 // latency; | 13 // latency; |
14 // 2) The delay between the moment getting the callback and the scheduled time | 14 // 2) The delay between the moment getting the callback and the scheduled time |
15 // stamp that tells when the data is going to be played out. | 15 // stamp that tells when the data is going to be played out. |
16 // | 16 // |
17 #ifndef MEDIA_AUDIO_MAC_AUDIO_AUHAL_MAC_H_ | 17 #ifndef MEDIA_AUDIO_MAC_AUDIO_AUHAL_MAC_H_ |
18 #define MEDIA_AUDIO_MAC_AUDIO_AUHAL_MAC_H_ | 18 #define MEDIA_AUDIO_MAC_AUDIO_AUHAL_MAC_H_ |
19 | 19 |
20 #include <AudioUnit/AudioUnit.h> | 20 #include <AudioUnit/AudioUnit.h> |
21 #include <CoreAudio/CoreAudio.h> | 21 #include <CoreAudio/CoreAudio.h> |
22 | 22 |
| 23 #include "base/cancelable_callback.h" |
23 #include "base/compiler_specific.h" | 24 #include "base/compiler_specific.h" |
24 #include "base/synchronization/lock.h" | 25 #include "base/synchronization/lock.h" |
25 #include "media/audio/audio_io.h" | 26 #include "media/audio/audio_io.h" |
26 #include "media/audio/audio_parameters.h" | 27 #include "media/audio/audio_parameters.h" |
27 | 28 |
28 namespace media { | 29 namespace media { |
29 | 30 |
30 class AudioManagerMac; | 31 class AudioManagerMac; |
31 class AudioPullFifo; | 32 class AudioPullFifo; |
32 | 33 |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 // Container for retrieving data from AudioSourceCallback::OnMoreIOData(). | 160 // Container for retrieving data from AudioSourceCallback::OnMoreIOData(). |
160 scoped_ptr<AudioBus> output_bus_; | 161 scoped_ptr<AudioBus> output_bus_; |
161 | 162 |
162 // Dynamically allocated FIFO used when CoreAudio asks for unexpected frame | 163 // Dynamically allocated FIFO used when CoreAudio asks for unexpected frame |
163 // sizes. | 164 // sizes. |
164 scoped_ptr<AudioPullFifo> audio_fifo_; | 165 scoped_ptr<AudioPullFifo> audio_fifo_; |
165 | 166 |
166 // Current buffer delay. Set by Render(). | 167 // Current buffer delay. Set by Render(). |
167 uint32 current_hardware_pending_bytes_; | 168 uint32 current_hardware_pending_bytes_; |
168 | 169 |
| 170 // Used to defer Start() to workaround http://crbug.com/160920. |
| 171 base::CancelableClosure deferred_start_cb_; |
| 172 |
169 DISALLOW_COPY_AND_ASSIGN(AUHALStream); | 173 DISALLOW_COPY_AND_ASSIGN(AUHALStream); |
170 }; | 174 }; |
171 | 175 |
172 } // namespace media | 176 } // namespace media |
173 | 177 |
174 #endif // MEDIA_AUDIO_MAC_AUDIO_AUHAL_MAC_H_ | 178 #endif // MEDIA_AUDIO_MAC_AUDIO_AUHAL_MAC_H_ |
OLD | NEW |