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

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

Issue 645923002: Add support for audio input mute detection on all platforms (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nit Created 6 years, 2 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/win/audio_low_latency_input_win.h ('k') | media/audio/win/wavein_input_win.h » ('j') | 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 9fe061b7682b6e7ceeb3f256307a8c34293d8b2d..8df8620b9f3decd7f23d45f87243b77e562c16bd 100644
--- a/media/audio/win/audio_low_latency_input_win.cc
+++ b/media/audio/win/audio_low_latency_input_win.cc
@@ -253,7 +253,7 @@ void WASAPIAudioInputStream::SetVolume(double volume) {
}
double WASAPIAudioInputStream::GetVolume() {
- DLOG_IF(ERROR, !opened_) << "Open() has not been called successfully";
+ DCHECK(opened_) << "Open() has not been called successfully";
if (!opened_)
return 0.0;
@@ -265,6 +265,20 @@ double WASAPIAudioInputStream::GetVolume() {
return static_cast<double>(level);
}
+bool WASAPIAudioInputStream::IsMuted() {
+ DCHECK(opened_) << "Open() has not been called successfully";
+ DCHECK(CalledOnValidThread());
+ if (!opened_)
+ return false;
+
+ // Retrieves the current muting state for the audio session.
+ BOOL is_muted = FALSE;
+ HRESULT hr = simple_audio_volume_->GetMute(&is_muted);
+ DLOG_IF(WARNING, FAILED(hr)) << "Failed to get input master volume.";
+
+ return is_muted != FALSE;
+}
+
// static
AudioParameters WASAPIAudioInputStream::GetInputStreamParameters(
const std::string& device_id) {
« no previous file with comments | « media/audio/win/audio_low_latency_input_win.h ('k') | media/audio/win/wavein_input_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698