Listen to a CoreAudio property to tell if audio hardware is playing audio in the current process.
Created attachment 227804 [details] patch
Attachment 227804 [details] did not pass style-queue: ERROR: Source/WebCore/ChangeLog:4: Line contains tab character. [whitespace/tab] [5] ERROR: Source/WebCore/ChangeLog:10: Line contains tab character. [whitespace/tab] [5] ERROR: Source/WebCore/platform/audio/mac/AudioHardwareListenerMac.cpp:34: enum members should use InterCaps with an initial capital letter. [readability/enum_casing] [4] ERROR: Source/WebCore/platform/audio/mac/AudioHardwareListenerMac.cpp:49: Tab found; better to use spaces [whitespace/tab] [1] ERROR: Source/WebCore/platform/audio/mac/AudioHardwareListenerMac.cpp:50: Tab found; better to use spaces [whitespace/tab] [1] ERROR: Source/WebCore/platform/audio/mac/AudioHardwareListenerMac.cpp:55: Tab found; better to use spaces [whitespace/tab] [1] ERROR: Source/WebCore/platform/audio/AudioHardwareListener.h:29: Alphabetical sorting problem. [build/include_order] [4] Total errors found: 7 in 7 files If any of these errors are false positives, please file a bug against check-webkit-style.
Comment on attachment 227804 [details] patch View in context: https://bugs.webkit.org/attachment.cgi?id=227804&action=review > Source/WebCore/platform/audio/AudioHardwareListener.h:47 > + static bool audioHardwareListenerIsSupported(); Is there a reason this needs to be a static method? Here's an alternative idea: > Source/WebCore/platform/audio/AudioHardwareListener.h:48 > + bool isHardwareActive() const { return m_active; } Consider this instead: enum HardwareActivityType { Unknown, IsActive, IsInactive, }; HardwareActivityType hardwareActivity() const { return m_activity; } > Source/WebCore/platform/audio/AudioHardwareListener.h:54 > + bool m_active; ...and: HardwareActivityType m_activity; > Source/WebCore/platform/audio/AudioHardwareListener.cpp:46 > + , m_active(false) ...and: , m_active(Unknown) This way, we don't neeed audioHardwareListenerIsSupported(), but instead `listener->hardwareActivity()` will return `Unknown` when hardware activity listening is unavailable.
http://trac.webkit.org/changeset/166442