Bug 130743 - WebCore portion to tell if audio is playing in a plugin process
Summary: WebCore portion to tell if audio is playing in a plugin process
Alias: None
Product: WebKit
Classification: Unclassified
Component: Media (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
Depends on:
Blocks: 130746
  Show dependency treegraph
Reported: 2014-03-25 15:09 PDT by Stephanie Lewis
Modified: 2014-03-28 18:21 PDT (History)
7 users (show)

See Also:

patch (22.20 KB, patch)
2014-03-25 15:12 PDT, Stephanie Lewis
jer.noble: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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]
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]

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 {
HardwareActivityType hardwareActivity() const { return m_activity; }

> Source/WebCore/platform/audio/AudioHardwareListener.h:54
> +    bool m_active;


HardwareActivityType m_activity;

> Source/WebCore/platform/audio/AudioHardwareListener.cpp:46
> +    , m_active(false)


    , 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