| 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 // Utility methods for the Core Audio API on Windows. | 5 // Utility methods for the Core Audio API on Windows. |
| 6 // Always ensure that Core Audio is supported before using these methods. | 6 // Always ensure that Core Audio is supported before using these methods. |
| 7 // Use media::CoreAudioIsSupported() for this purpose. | 7 // Use media::CoreAudioIsSupported() for this purpose. |
| 8 // Also, all methods must be called on a valid COM thread. This can be done | 8 // Also, all methods must be called on a valid COM thread. This can be done |
| 9 // by using the base::win::ScopedCOMInitializer helper class. | 9 // by using the base::win::ScopedCOMInitializer helper class. |
| 10 | 10 |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 static HRESULT GetDefaultSharedModeMixFormat(EDataFlow data_flow, | 110 static HRESULT GetDefaultSharedModeMixFormat(EDataFlow data_flow, |
| 111 ERole role, | 111 ERole role, |
| 112 WAVEFORMATPCMEX* format); | 112 WAVEFORMATPCMEX* format); |
| 113 | 113 |
| 114 // Returns true if the specified |client| supports the format in |format| | 114 // Returns true if the specified |client| supports the format in |format| |
| 115 // for the given |share_mode| (shared or exclusive). | 115 // for the given |share_mode| (shared or exclusive). |
| 116 static bool IsFormatSupported(IAudioClient* client, | 116 static bool IsFormatSupported(IAudioClient* client, |
| 117 AUDCLNT_SHAREMODE share_mode, | 117 AUDCLNT_SHAREMODE share_mode, |
| 118 const WAVEFORMATPCMEX* format); | 118 const WAVEFORMATPCMEX* format); |
| 119 | 119 |
| 120 // Returns true if the specified |channel_layout| is supported for the |
| 121 // default IMMDevice where flow direction and role is define by |data_flow| |
| 122 // and |role|. If this method returns true for a certain channel layout, it |
| 123 // means that SharedModeInitialize() will succeed using a format based on |
| 124 // the preferred format where the channel layout has been modified. |
| 125 static bool IsChannelLayoutSupported(EDataFlow data_flow, ERole role, |
| 126 ChannelLayout channel_layout); |
| 127 |
| 120 // For a shared-mode stream, the audio engine periodically processes the | 128 // For a shared-mode stream, the audio engine periodically processes the |
| 121 // data in the endpoint buffer at the period obtained in |device_period|. | 129 // data in the endpoint buffer at the period obtained in |device_period|. |
| 122 // For an exclusive mode stream, |device_period| corresponds to the minimum | 130 // For an exclusive mode stream, |device_period| corresponds to the minimum |
| 123 // time interval between successive processing by the endpoint device. | 131 // time interval between successive processing by the endpoint device. |
| 124 // This period plus the stream latency between the buffer and endpoint device | 132 // This period plus the stream latency between the buffer and endpoint device |
| 125 // represents the minimum possible latency that an audio application can | 133 // represents the minimum possible latency that an audio application can |
| 126 // achieve. The time in |device_period| is expressed in 100-nanosecond units. | 134 // achieve. The time in |device_period| is expressed in 100-nanosecond units. |
| 127 static HRESULT GetDevicePeriod(IAudioClient* client, | 135 static HRESULT GetDevicePeriod(IAudioClient* client, |
| 128 AUDCLNT_SHAREMODE share_mode, | 136 AUDCLNT_SHAREMODE share_mode, |
| 129 REFERENCE_TIME* device_period); | 137 REFERENCE_TIME* device_period); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 | 179 |
| 172 private: | 180 private: |
| 173 CoreAudioUtil() {} | 181 CoreAudioUtil() {} |
| 174 ~CoreAudioUtil() {} | 182 ~CoreAudioUtil() {} |
| 175 DISALLOW_COPY_AND_ASSIGN(CoreAudioUtil); | 183 DISALLOW_COPY_AND_ASSIGN(CoreAudioUtil); |
| 176 }; | 184 }; |
| 177 | 185 |
| 178 } // namespace media | 186 } // namespace media |
| 179 | 187 |
| 180 #endif // MEDIA_AUDIO_WIN_CORE_AUDIO_UTIL_WIN_H_ | 188 #endif // MEDIA_AUDIO_WIN_CORE_AUDIO_UTIL_WIN_H_ |
| OLD | NEW |