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

Unified Diff: media/audio/win/audio_low_latency_input_win.cc

Issue 2144333002: MuteSource Audio During Full Screen Cast (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Mute system audio for getUserMedia(audio:System) Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
« media/audio/cras/cras_input.cc ('K') | « media/audio/cras/cras_input.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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());
« media/audio/cras/cras_input.cc ('K') | « media/audio/cras/cras_input.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698