Commit c99d3a88 authored by henrika's avatar henrika Committed by Commit Bot

Adds support for audio capture-effect enumeration on Windows - part 2

Contains additional changes and improvements proposed after landing
by robliao@.

Bug: 1133643
Change-Id: Ib05e3878b70fc10fa5255645d4551639e2c96587
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2514423
Commit-Queue: Henrik Andreasson <henrika@chromium.org>
Reviewed-by: default avatarRobert Liao <robliao@chromium.org>
Cr-Commit-Position: refs/heads/master@{#823252}
parent dbe0ea06
...@@ -218,25 +218,32 @@ std::string GetOpenLogString(WASAPIAudioInputStream::StreamOpenResult result, ...@@ -218,25 +218,32 @@ std::string GetOpenLogString(WASAPIAudioInputStream::StreamOpenResult result,
} }
bool InitializeUWPSupport() { bool InitializeUWPSupport() {
// Windows.Media.Effects and Windows.Media.Devices requires Windows 10 build // Place the actual body of the initialization in a lambda and store the
// 10.0.10240.0. // result as a static since we don't expect this result to change between
if (base::win::GetVersion() < base::win::Version::WIN10) { // runs.
DLOG(WARNING) << "AudioCaptureEffectsManager requires Windows 10"; static const bool initialization_result = []() {
return false; // Windows.Media.Effects and Windows.Media.Devices requires Windows 10 build
} // 10.0.10240.0.
DCHECK_GE(base::win::OSInfo::GetInstance()->version_number().build, 10240); if (base::win::GetVersion() < base::win::Version::WIN10) {
DLOG(WARNING) << "AudioCaptureEffectsManager requires Windows 10";
// Provide access to Core WinRT/UWP functions and load all required HSTRING return false;
// functions available from Win8 and onwards. ScopedHString is a wrapper }
// around an HSTRING and it requires certain functions that need to be DCHECK_GE(base::win::OSInfo::GetInstance()->version_number().build, 10240);
// delayloaded to avoid breaking Chrome on Windows 7.
if (!(base::win::ResolveCoreWinRTDelayload() && // Provide access to Core WinRT/UWP functions and load all required HSTRING
base::win::ScopedHString::ResolveCoreWinRTStringDelayload())) { // functions available from Win8 and onwards. ScopedHString is a wrapper
// Failed loading functions from combase.dll. // around an HSTRING and it requires certain functions that need to be
DLOG(WARNING) << "Failed to initialize WinRT/UWP"; // delayloaded to avoid breaking Chrome on Windows 7.
return false; if (!(base::win::ResolveCoreWinRTDelayload() &&
} base::win::ScopedHString::ResolveCoreWinRTStringDelayload())) {
return true; // Failed loading functions from combase.dll.
DLOG(WARNING) << "Failed to initialize WinRT/UWP";
return false;
}
return true;
}();
return initialization_result;
} }
} // namespace } // namespace
...@@ -1169,7 +1176,7 @@ HRESULT WASAPIAudioInputStream::GetAudioCaptureEffects( ...@@ -1169,7 +1176,7 @@ HRESULT WASAPIAudioInputStream::GetAudioCaptureEffects(
} }
return hr; return hr;
} // namespace media }
HRESULT WASAPIAudioInputStream::SetCommunicationsCategoryAndRawCaptureMode() { HRESULT WASAPIAudioInputStream::SetCommunicationsCategoryAndRawCaptureMode() {
DCHECK(audio_client_.Get()); DCHECK(audio_client_.Get());
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment