IAudioEndpointVolume
AudioDeviceWindowsCore

源码分析
H:\webrtc-20210315\webrtc-20210315\webrtc\webrtc-checkout\src\media\engine\adm_helpers.cc
void Init(AudioDeviceModule* adm) 方法
webrtc::adm_helpers::Init
void Init(AudioDeviceModule* adm) {***// Recording device.{if (adm->SetRecordingDevice(AUDIO_DEVICE_ID) != 0) {RTC_LOG(LS_ERROR) << "Unable to set recording device.";return;}if (adm->InitMicrophone() != 0) {RTC_LOG(LS_ERROR) << "Unable to access microphone.";}// Set number of channelsbool available = false;if (adm->StereoRecordingIsAvailable(&available) != 0) {RTC_LOG(LS_ERROR) << "Failed to query stereo recording.";}if (adm->SetStereoRecording(available) != 0) {RTC_LOG(LS_ERROR) << "Failed to set stereo recording mode.";}}}adm->InitMicrophone()->AudioDeviceModuleImpl::InitMicrophone->AudioDeviceWindowsCore::InitMicrophone->AudioDeviceWindowsCore::InitMicrophoneLocked
AudioDeviceWindowsCore::InitMicrophoneLocked
int32_t AudioDeviceWindowsCore::InitMicrophoneLocked() {**if (_usingInputDeviceIndex) {**} else {ERole role;(_inputDevice == AudioDeviceModule::kDefaultDevice)? role = eConsole: role = eCommunications;// Refresh the selected capture endpoint device using roleret = _GetDefaultDevice(eCapture, role, &_ptrDeviceIn);}**SAFE_RELEASE(_ptrCaptureVolume);ret = _ptrDeviceIn->Activate(__uuidof(IAudioEndpointVolume), CLSCTX_ALL, NULL,reinterpret_cast<void**>(&_ptrCaptureVolume));if (ret != 0 || _ptrCaptureVolume == NULL) {RTC_LOG(LS_ERROR) << "failed to initialize the capture volume";SAFE_RELEASE(_ptrCaptureVolume);return -1;}_microphoneIsInitialized = true;return 0;}

