Index: media/audio/mac/audio_low_latency_input_mac.cc |
diff --git a/media/audio/mac/audio_low_latency_input_mac.cc b/media/audio/mac/audio_low_latency_input_mac.cc |
index 1baa09f1fe07f0e2b4d5a89c017eaf53c8a23247..08d40b68f6c5162507d0ee6516f33a54c6d98832 100644 |
--- a/media/audio/mac/audio_low_latency_input_mac.cc |
+++ b/media/audio/mac/audio_low_latency_input_mac.cc |
@@ -451,6 +451,34 @@ double AUAudioInputStream::GetVolume() { |
return 0.0; |
} |
+bool AUAudioInputStream::IsMuted() { |
+ // Verify that we have a valid device. |
+ if (input_device_id_ == kAudioObjectUnknown) { |
+ NOTREACHED() << "Device ID is unknown"; |
tommi (sloooow) - chröme
2014/10/15 17:00:48
should this be a DCHECK then?
DCHECK_NE(input_dev
|
+ return false; |
+ } |
+ |
+ AudioObjectPropertyAddress property_address = { |
+ kAudioDevicePropertyMute, |
tommi (sloooow) - chröme
2014/10/15 17:00:48
nit: indent by two spaces and put the closing brac
henrika (OOO until Aug 14)
2014/10/16 09:58:00
Done.
|
+ kAudioDevicePropertyScopeInput, |
+ kAudioObjectPropertyElementMaster}; |
+ |
+ if (!AudioObjectHasProperty(input_device_id_, &property_address)) { |
+ NOTREACHED() << "Device does not support checking master mute state"; |
tommi (sloooow) - chröme
2014/10/15 17:00:48
since NOTREACHED is essentially the same as DCHECK
henrika (OOO until Aug 14)
2014/10/16 09:58:00
Done.
|
+ return false; |
+ } |
+ |
+ UInt32 muted = 0; |
+ UInt32 size = sizeof(muted); |
+ OSStatus result = AudioObjectGetPropertyData( |
+ input_device_id_, &property_address, 0, NULL, &size, &muted); |
+ if (result == noErr) |
+ return static_cast<bool>(muted); |
tommi (sloooow) - chröme
2014/10/15 17:00:48
nit: return muted != 0u;
actually, you could also
henrika (OOO until Aug 14)
2014/10/16 09:58:00
Done.
|
+ |
+ DLOG(WARNING) << "Failed to get mute state"; |
+ return false; |
+} |
+ |
// AUHAL AudioDeviceOutput unit callback |
OSStatus AUAudioInputStream::InputProc(void* user_data, |
AudioUnitRenderActionFlags* flags, |