| Index: media/audio/win/audio_low_latency_input_win.cc
|
| diff --git a/media/audio/win/audio_low_latency_input_win.cc b/media/audio/win/audio_low_latency_input_win.cc
|
| index 949d681945f058919e25758b9509bfb3aaa295b9..f1af6494b3da68f052ca17555330034ff23fccf6 100644
|
| --- a/media/audio/win/audio_low_latency_input_win.cc
|
| +++ b/media/audio/win/audio_low_latency_input_win.cc
|
| @@ -4,6 +4,7 @@
|
|
|
| #include "media/audio/win/audio_low_latency_input_win.h"
|
|
|
| +#include <endpointvolume.h>
|
| #include <memory>
|
|
|
| #include "base/logging.h"
|
| @@ -165,6 +166,13 @@ void WASAPIAudioInputStream::Stop() {
|
| if (!started_)
|
| return;
|
|
|
| + if (device_id_ == AudioDeviceDescription::kLoopbackWithMuteDeviceId) {
|
| + IAudioEndpointVolume* pVolume = NULL;
|
| + HRESULT hr =
|
| + endpoint_device_->Activate(__uuidof(IAudioEndpointVolume), CLSCTX_ALL,
|
| + NULL, reinterpret_cast<void**>(&pVolume));
|
| + hr = pVolume->SetMute(false, NULL);
|
| + }
|
| // Stops periodic AGC microphone measurements.
|
| StopAgc();
|
|
|
| @@ -471,6 +479,16 @@ HRESULT WASAPIAudioInputStream::SetCaptureDevice() {
|
| } else if (device_id_ == AudioDeviceDescription::kCommunicationsDeviceId) {
|
| hr = enumerator->GetDefaultAudioEndpoint(eCapture, eCommunications,
|
| endpoint_device_.Receive());
|
| + } else if (device_id_ == AudioDeviceDescription::kLoopbackWithMuteDeviceId) {
|
| + // Capture the default playback stream.
|
| + hr = enumerator->GetDefaultAudioEndpoint(eRender, eConsole,
|
| + endpoint_device_.Receive());
|
| +
|
| + IAudioEndpointVolume* pVolume = NULL;
|
| + HRESULT hr2 =
|
| + endpoint_device_->Activate(__uuidof(IAudioEndpointVolume), CLSCTX_ALL,
|
| + NULL, reinterpret_cast<void**>(&pVolume));
|
| + hr2 = pVolume->SetMute(true, NULL);
|
| } else if (device_id_ == AudioDeviceDescription::kLoopbackInputDeviceId) {
|
| // Capture the default playback stream.
|
| hr = enumerator->GetDefaultAudioEndpoint(eRender, eConsole,
|
| @@ -572,7 +590,8 @@ HRESULT WASAPIAudioInputStream::InitializeAudioEngine() {
|
| // Use event-driven mode only fo regular input devices. For loopback the
|
| // EVENTCALLBACK flag is specified when intializing
|
| // |audio_render_client_for_loopback_|.
|
| - if (device_id_ == AudioDeviceDescription::kLoopbackInputDeviceId) {
|
| + if (device_id_ == AudioDeviceDescription::kLoopbackInputDeviceId ||
|
| + device_id_ == AudioDeviceDescription::kLoopbackWithMuteDeviceId) {
|
| flags = AUDCLNT_STREAMFLAGS_LOOPBACK | AUDCLNT_STREAMFLAGS_NOPERSIST;
|
| } else {
|
| flags = AUDCLNT_STREAMFLAGS_EVENTCALLBACK | AUDCLNT_STREAMFLAGS_NOPERSIST;
|
| @@ -646,7 +665,8 @@ HRESULT WASAPIAudioInputStream::InitializeAudioEngine() {
|
| // samples from the capture endpoint buffer.
|
| //
|
| // http://msdn.microsoft.com/en-us/library/windows/desktop/dd316551(v=vs.85).aspx
|
| - if (device_id_ == AudioDeviceDescription::kLoopbackInputDeviceId) {
|
| + if (device_id_ == AudioDeviceDescription::kLoopbackInputDeviceId ||
|
| + device_id_ == AudioDeviceDescription::kLoopbackWithMuteDeviceId) {
|
| hr = endpoint_device_->Activate(
|
| __uuidof(IAudioClient), CLSCTX_INPROC_SERVER, NULL,
|
| audio_render_client_for_loopback_.ReceiveVoid());
|
|
|