Bug 130743

Summary: WebCore portion to tell if audio is playing in a plugin process
Product: WebKit Reporter: Stephanie Lewis <slewis>
Component: MediaAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, eric.carlson, glenn, jer.noble, philipj, sergio, slewis
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 130746    
Attachments:
Description Flags
patch jer.noble: review+

Description Stephanie Lewis 2014-03-25 15:09:47 PDT
Listen to a CoreAudio property to tell if audio hardware is playing audio in the current process.
Comment 1 Stephanie Lewis 2014-03-25 15:12:26 PDT
Created attachment 227804 [details]
patch
Comment 2 WebKit Commit Bot 2014-03-25 15:13:56 PDT
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 3 Jer Noble 2014-03-25 15:35:29 PDT
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.
Comment 4 Stephanie Lewis 2014-03-28 18:21:14 PDT
http://trac.webkit.org/changeset/166442