Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(362)

Side by Side Diff: media/audio/win/core_audio_util_win.cc

Issue 2889263002: Remove Interface ID Template Parameter from ScopedComPtr (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/utility/importer/ie_importer_win.cc ('k') | remoting/host/setup/win/auth_code_getter.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <devicetopology.h> 7 #include <devicetopology.h>
8 #include <dxdiag.h> 8 #include <dxdiag.h>
9 #include <functiondiscoverykeys_devpkey.h> 9 #include <functiondiscoverykeys_devpkey.h>
10 #include <objbase.h> 10 #include <objbase.h>
(...skipping 859 matching lines...) Expand 10 before | Expand all | Expand 10 after
870 870
871 // Using the AUDCLNT_BUFFERFLAGS_SILENT flag eliminates the need to 871 // Using the AUDCLNT_BUFFERFLAGS_SILENT flag eliminates the need to
872 // explicitly write silence data to the rendering buffer. 872 // explicitly write silence data to the rendering buffer.
873 DVLOG(2) << "filling up " << num_frames_to_fill << " frames with silence"; 873 DVLOG(2) << "filling up " << num_frames_to_fill << " frames with silence";
874 return SUCCEEDED(render_client->ReleaseBuffer(num_frames_to_fill, 874 return SUCCEEDED(render_client->ReleaseBuffer(num_frames_to_fill,
875 AUDCLNT_BUFFERFLAGS_SILENT)); 875 AUDCLNT_BUFFERFLAGS_SILENT));
876 } 876 }
877 877
878 bool CoreAudioUtil::GetDxDiagDetails(std::string* driver_name, 878 bool CoreAudioUtil::GetDxDiagDetails(std::string* driver_name,
879 std::string* driver_version) { 879 std::string* driver_version) {
880 ScopedComPtr<IDxDiagProvider, &IID_IDxDiagProvider> provider; 880 ScopedComPtr<IDxDiagProvider> provider;
881 HRESULT hr = 881 HRESULT hr =
882 ::CoCreateInstance(CLSID_DxDiagProvider, NULL, CLSCTX_INPROC_SERVER, 882 ::CoCreateInstance(CLSID_DxDiagProvider, NULL, CLSCTX_INPROC_SERVER,
883 IID_IDxDiagProvider, &provider); 883 IID_IDxDiagProvider, &provider);
884 if (FAILED(hr)) 884 if (FAILED(hr))
885 return false; 885 return false;
886 886
887 DXDIAG_INIT_PARAMS params = {sizeof(params)}; 887 DXDIAG_INIT_PARAMS params = {sizeof(params)};
888 params.dwDxDiagHeaderVersion = DXDIAG_DX9_SDK_VERSION; 888 params.dwDxDiagHeaderVersion = DXDIAG_DX9_SDK_VERSION;
889 params.bAllowWHQLChecks = FALSE; 889 params.bAllowWHQLChecks = FALSE;
890 params.pReserved = NULL; 890 params.pReserved = NULL;
891 hr = provider->Initialize(&params); 891 hr = provider->Initialize(&params);
892 if (FAILED(hr)) 892 if (FAILED(hr))
893 return false; 893 return false;
894 894
895 ScopedComPtr<IDxDiagContainer, &IID_IDxDiagContainer> root; 895 ScopedComPtr<IDxDiagContainer> root;
896 hr = provider->GetRootContainer(root.GetAddressOf()); 896 hr = provider->GetRootContainer(root.GetAddressOf());
897 if (FAILED(hr)) 897 if (FAILED(hr))
898 return false; 898 return false;
899 899
900 // Limit to the SoundDevices subtree. The tree in its entirity is 900 // Limit to the SoundDevices subtree. The tree in its entirity is
901 // enormous and only this branch contains useful information. 901 // enormous and only this branch contains useful information.
902 ScopedComPtr<IDxDiagContainer, &IID_IDxDiagContainer> sound_devices; 902 ScopedComPtr<IDxDiagContainer> sound_devices;
903 hr = root->GetChildContainer(L"DxDiag_DirectSound.DxDiag_SoundDevices.0", 903 hr = root->GetChildContainer(L"DxDiag_DirectSound.DxDiag_SoundDevices.0",
904 sound_devices.GetAddressOf()); 904 sound_devices.GetAddressOf());
905 if (FAILED(hr)) 905 if (FAILED(hr))
906 return false; 906 return false;
907 907
908 base::win::ScopedVariant variant; 908 base::win::ScopedVariant variant;
909 hr = sound_devices->GetProp(L"szDriverName", variant.Receive()); 909 hr = sound_devices->GetProp(L"szDriverName", variant.Receive());
910 if (FAILED(hr)) 910 if (FAILED(hr))
911 return false; 911 return false;
912 912
913 if (variant.type() == VT_BSTR && variant.ptr()->bstrVal) { 913 if (variant.type() == VT_BSTR && variant.ptr()->bstrVal) {
914 base::WideToUTF8(variant.ptr()->bstrVal, wcslen(variant.ptr()->bstrVal), 914 base::WideToUTF8(variant.ptr()->bstrVal, wcslen(variant.ptr()->bstrVal),
915 driver_name); 915 driver_name);
916 } 916 }
917 917
918 variant.Reset(); 918 variant.Reset();
919 hr = sound_devices->GetProp(L"szDriverVersion", variant.Receive()); 919 hr = sound_devices->GetProp(L"szDriverVersion", variant.Receive());
920 if (FAILED(hr)) 920 if (FAILED(hr))
921 return false; 921 return false;
922 922
923 if (variant.type() == VT_BSTR && variant.ptr()->bstrVal) { 923 if (variant.type() == VT_BSTR && variant.ptr()->bstrVal) {
924 base::WideToUTF8(variant.ptr()->bstrVal, wcslen(variant.ptr()->bstrVal), 924 base::WideToUTF8(variant.ptr()->bstrVal, wcslen(variant.ptr()->bstrVal),
925 driver_version); 925 driver_version);
926 } 926 }
927 927
928 return true; 928 return true;
929 } 929 }
930 930
931 } // namespace media 931 } // namespace media
OLDNEW
« no previous file with comments | « chrome/utility/importer/ie_importer_win.cc ('k') | remoting/host/setup/win/auth_code_getter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698