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

Unified Diff: media/audio/cras/cras_input.cc

Issue 2144333002: MuteSource Audio During Full Screen Cast (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase 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
« no previous file with comments | « media/audio/cras/cras_input.h ('k') | media/audio/win/audio_low_latency_input_win.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/audio/cras/cras_input.cc
diff --git a/media/audio/cras/cras_input.cc b/media/audio/cras/cras_input.cc
index 9f2e46944fa248a79cf4b9bcb55fa88d1b9e3c23..e8b08eed9d665eca25b05bde15e3ed7ef960c765 100644
--- a/media/audio/cras/cras_input.cc
+++ b/media/audio/cras/cras_input.cc
@@ -28,8 +28,12 @@ CrasInputStream::CrasInputStream(const AudioParameters& params,
stream_id_(0),
stream_direction_(CRAS_STREAM_INPUT),
pin_device_(NO_DEVICE),
- is_loopback_(device_id ==
- AudioDeviceDescription::kLoopbackInputDeviceId) {
+ is_loopback_(
+ device_id == AudioDeviceDescription::kLoopbackInputDeviceId ||
+ device_id == AudioDeviceDescription::kLoopbackWithMuteDeviceId),
+ mute_system_audio_(device_id ==
+ AudioDeviceDescription::kLoopbackWithMuteDeviceId),
+ mute_done_(false) {
DCHECK(audio_manager_);
audio_bus_ = AudioBus::Create(params_);
if (!IsDefault(device_id)) {
@@ -99,6 +103,7 @@ bool CrasInputStream::Open() {
client_ = NULL;
return false;
}
+
pin_device_ = cras_client_get_first_dev_type_idx(client_,
CRAS_NODE_TYPE_POST_MIX_PRE_DSP, CRAS_STREAM_INPUT);
if (pin_device_ < 0) {
@@ -223,6 +228,12 @@ void CrasInputStream::Start(AudioInputCallback* callback) {
callback_ = NULL;
}
+ // Mute system audio if requested.
+ if (mute_system_audio_ && !cras_client_get_system_muted(client_)) {
+ cras_client_set_system_mute(client_, 1);
+ mute_done_ = true;
+ }
+
// Done with config params.
cras_audio_format_destroy(audio_format);
cras_client_stream_params_destroy(stream_params);
@@ -237,6 +248,11 @@ void CrasInputStream::Stop() {
if (!callback_ || !started_)
return;
+ if (mute_system_audio_ && mute_done_) {
+ cras_client_set_system_mute(client_, 0);
+ mute_done_ = false;
+ }
+
StopAgc();
// Removing the stream from the client stops audio.
« no previous file with comments | « media/audio/cras/cras_input.h ('k') | media/audio/win/audio_low_latency_input_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698