Use AudioStreamMonitor to control power save blocking.
commit484d29dcb45ca362fc9049c37dd3a51e11492f14
authordalecurtis <dalecurtis@chromium.org>
Thu, 11 Sep 2014 02:51:40 +0000 (10 19:51 -0700)
committerCommit bot <commit-bot@chromium.org>
Thu, 11 Sep 2014 03:07:16 +0000 (11 03:07 +0000)
treecec6b893a679431117b957c975ada3f7e0a946fa
parente6492dbcddf1845779da22d0de309bb9e496dd2c
Use AudioStreamMonitor to control power save blocking.

Prevents looping, soundless videos from preventing system sleep if they're
in a background tab. We don't want soundless videos in the main tab to
allow sleeping as they'll impact the muted video + captions use case.

Reworks WebContentsImpl to track active media players and whether the
attached WebContents is visible. When visible and there's an active video
player, it will create a power save blocker. One blocker is shared for all
active media players for simplicity.

Reworks AudioStreamMonitor to handle the PowerSaveBlocker for audio
such that one is only created when non-silent audio is present.

To prevent splitting power blocking duties across chrome/ and content/,
AudioStreamMonitor now lives in content/.  WebContents exposes a
WasRecentlyAudible() method for the existing tab audio indicator.

BUG=43667,367785
TEST=manual.

Review URL: https://codereview.chromium.org/478543003

Cr-Commit-Position: refs/heads/master@{#294303}
21 files changed:
chrome/browser/media/OWNERS
chrome/browser/media/audio_stream_monitor.cc [deleted file]
chrome/browser/media/media_capture_devices_dispatcher.cc
chrome/browser/media/media_capture_devices_dispatcher.h
chrome/browser/ui/tabs/tab_utils.cc
chrome/chrome_browser.gypi
chrome/chrome_tests_unit.gypi
content/browser/media/OWNERS
content/browser/media/audio_stream_monitor.cc [new file with mode: 0644]
content/browser/media/audio_stream_monitor.h [moved from chrome/browser/media/audio_stream_monitor.h with 58% similarity]
content/browser/media/audio_stream_monitor_unittest.cc [moved from chrome/browser/media/audio_stream_monitor_unittest.cc with 68% similarity]
content/browser/renderer_host/media/audio_renderer_host.cc
content/browser/web_contents/web_contents_impl.cc
content/browser/web_contents/web_contents_impl.h
content/browser/web_contents/web_contents_impl_unittest.cc
content/content_browser.gypi
content/content_tests.gypi
content/public/browser/media_observer.h
content/public/browser/web_contents.h
media/audio/audio_output_controller.cc
media/audio/audio_output_controller.h