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

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: 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
« media/audio/audio_io.h ('K') | « media/audio/win/audio_low_latency_input_win.h ('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 9fe061b7682b6e7ceeb3f256307a8c34293d8b2d..2a6f4a6c31a869f02e5fbed7d8f0d996bb3ff0d3 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 == TRUE) ? true : false;
tommi (sloooow) - chröme 2014/10/10 15:54:36 checking for TRUE always makes me nervous on windo
henrika (OOO until Aug 14) 2014/10/13 12:27:17 Thx. Actually checked the exact same link before m
+}
+
// static
AudioParameters WASAPIAudioInputStream::GetInputStreamParameters(
const std::string& device_id) {
« media/audio/audio_io.h ('K') | « media/audio/win/audio_low_latency_input_win.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698