| 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 #include "media/audio/win/core_audio_util_win.h" | 5 #include "media/audio/win/core_audio_util_win.h" |
| 6 | 6 |
| 7 #include <Audioclient.h> | 7 #include <Audioclient.h> |
| 8 #include <Functiondiscoverykeys_devpkey.h> | 8 #include <Functiondiscoverykeys_devpkey.h> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 device_enumerator.ReceiveVoid()); | 140 device_enumerator.ReceiveVoid()); |
| 141 | 141 |
| 142 // If we hit CO_E_NOTINITIALIZED, CoInitialize has not been called and it | 142 // If we hit CO_E_NOTINITIALIZED, CoInitialize has not been called and it |
| 143 // must be called at least once for each thread that uses the COM library. | 143 // must be called at least once for each thread that uses the COM library. |
| 144 CHECK_NE(hr, CO_E_NOTINITIALIZED); | 144 CHECK_NE(hr, CO_E_NOTINITIALIZED); |
| 145 | 145 |
| 146 return SUCCEEDED(hr); | 146 return SUCCEEDED(hr); |
| 147 } | 147 } |
| 148 | 148 |
| 149 bool CoreAudioUtil::IsSupported() { | 149 bool CoreAudioUtil::IsSupported() { |
| 150 // It is possible to force usage of WaveXxx APIs by using a command line flag. |
| 151 const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); |
| 152 if (cmd_line->HasSwitch(switches::kForceWaveAudio)) { |
| 153 LOG(WARNING) << "Forcing usage of Windows WaveXxx APIs"; |
| 154 return false; |
| 155 } |
| 156 |
| 150 // Microsoft does not plan to make the Core Audio APIs available for use | 157 // Microsoft does not plan to make the Core Audio APIs available for use |
| 151 // with earlier versions of Windows, including Microsoft Windows Server 2003, | 158 // with earlier versions of Windows, including Microsoft Windows Server 2003, |
| 152 // Windows XP, Windows Millennium Edition, Windows 2000, and Windows 98. | 159 // Windows XP, Windows Millennium Edition, Windows 2000, and Windows 98. |
| 153 if (base::win::GetVersion() < base::win::VERSION_VISTA) | 160 if (base::win::GetVersion() < base::win::VERSION_VISTA) |
| 154 return false; | 161 return false; |
| 155 | 162 |
| 156 // The audio core APIs are implemented in the Mmdevapi.dll and Audioses.dll | 163 // The audio core APIs are implemented in the Mmdevapi.dll and Audioses.dll |
| 157 // system components. | 164 // system components. |
| 158 // Dependency Walker shows that it is enough to verify possibility to load | 165 // Dependency Walker shows that it is enough to verify possibility to load |
| 159 // the Audioses DLL since it depends on Mmdevapi.dll. | 166 // the Audioses DLL since it depends on Mmdevapi.dll. |
| (...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 689 return false; | 696 return false; |
| 690 | 697 |
| 691 // Using the AUDCLNT_BUFFERFLAGS_SILENT flag eliminates the need to | 698 // Using the AUDCLNT_BUFFERFLAGS_SILENT flag eliminates the need to |
| 692 // explicitly write silence data to the rendering buffer. | 699 // explicitly write silence data to the rendering buffer. |
| 693 DVLOG(2) << "filling up " << num_frames_to_fill << " frames with silence"; | 700 DVLOG(2) << "filling up " << num_frames_to_fill << " frames with silence"; |
| 694 return SUCCEEDED(render_client->ReleaseBuffer(num_frames_to_fill, | 701 return SUCCEEDED(render_client->ReleaseBuffer(num_frames_to_fill, |
| 695 AUDCLNT_BUFFERFLAGS_SILENT)); | 702 AUDCLNT_BUFFERFLAGS_SILENT)); |
| 696 } | 703 } |
| 697 | 704 |
| 698 } // namespace media | 705 } // namespace media |
| OLD | NEW |