Add check to see if output device has HogMode property (Mac OS X)

Bug: webrtc:8549
Change-Id: I952db26de02ccce8155762531cbae9411abafb28
Reviewed-on: https://webrtc-review.googlesource.com/24125
Commit-Queue: Henrik Andreassson <henrika@webrtc.org>
Reviewed-by: Henrik Andreassson <henrika@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#20809}
diff --git a/modules/audio_device/mac/audio_mixer_manager_mac.cc b/modules/audio_device/mac/audio_mixer_manager_mac.cc
index 0e7d0fc..0932e8b 100644
--- a/modules/audio_device/mac/audio_mixer_manager_mac.cc
+++ b/modules/audio_device/mac/audio_mixer_manager_mac.cc
@@ -105,21 +105,25 @@
   AudioObjectPropertyAddress propertyAddress = {
       kAudioDevicePropertyHogMode, kAudioDevicePropertyScopeOutput, 0};
 
-  size = sizeof(hogPid);
-  WEBRTC_CA_RETURN_ON_ERR(AudioObjectGetPropertyData(
-      _outputDeviceID, &propertyAddress, 0, NULL, &size, &hogPid));
+  // First, does it have the property? Aggregate devices don't.
+  if (AudioObjectHasProperty(_outputDeviceID, &propertyAddress)) {
+    size = sizeof(hogPid);
+    WEBRTC_CA_RETURN_ON_ERR(AudioObjectGetPropertyData(
+        _outputDeviceID, &propertyAddress, 0, NULL, &size, &hogPid));
 
-  if (hogPid == -1) {
-    RTC_LOG(LS_VERBOSE) << "No process has hogged the input device";
-  }
-  // getpid() is apparently "always successful"
-  else if (hogPid == getpid()) {
-    RTC_LOG(LS_VERBOSE) << "Our process has hogged the input device";
-  } else {
-    RTC_LOG(LS_WARNING) << "Another process (pid = " << static_cast<int>(hogPid)
-                        << ") has hogged the input device";
+    if (hogPid == -1) {
+      RTC_LOG(LS_VERBOSE) << "No process has hogged the output device";
+    }
+    // getpid() is apparently "always successful"
+    else if (hogPid == getpid()) {
+      RTC_LOG(LS_VERBOSE) << "Our process has hogged the output device";
+    } else {
+      RTC_LOG(LS_WARNING) << "Another process (pid = "
+                          << static_cast<int>(hogPid)
+                          << ") has hogged the output device";
 
-    return -1;
+      return -1;
+    }
   }
 
   // get number of channels from stream format