Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(36)

Issue 1195633003: Add a silent audio sink to consume WebAudio data on silence detection. (Closed)

Created:
5 years, 6 months ago by qinmin
Modified:
5 years, 6 months ago
Reviewers:
DaleCurtis, Raymond Toy
CC:
chromium-reviews, darin-cc_chromium.org, feature-media-reviews_chromium.org, jam, mcasas+watch_chromium.org, mkwst+moarreviews-renderer_chromium.org, mlamouri (slow - plz ping), posciak+watch_chromium.org, wjia+watch_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Add a silent audio sink to consume WebAudio data on silence detection. The current android implementation of WebAudio is not power friendly. It holds the AudioMix wakelock, and causes a lot of battery consumption even if tab is backgrounded. When an AudioContext is created, WebAudio will start enqueueing data to the output device. This happens even when no data is decoded or no audio buffer is appended. This CL adds a SilentAudioSink to consume data when consecutive empty audio buffers are received. In the idle mode, the player will no longer enqueue data to the output device. It regularly check the received data and exits the idle mode if non-empty data are encountered. The intervals to check the data is calculated by the consumption time of the last received buffer. BUG=470153 Committed: https://crrev.com/bda540eb1cbfd36dda3eec0206913331ca1ab822 Cr-Commit-Position: refs/heads/master@{#335799}

Patch Set 1 #

Patch Set 2 : add missing silent_audio_sink.cc #

Patch Set 3 : simplify the CL to use NullAudioSink #

Total comments: 15

Patch Set 4 : addressing comments #

Total comments: 31

Patch Set 5 : remove weak_ptr #

Total comments: 6

Patch Set 6 : nits #

Patch Set 7 : ifdef android only constants #

Unified diffs Side-by-side diffs Delta from patch set Stats (+123 lines, -18 lines) Patch
M content/renderer/media/renderer_webaudiodevice_impl.h View 1 2 3 4 3 chunks +30 lines, -0 lines 0 comments Download
M content/renderer/media/renderer_webaudiodevice_impl.cc View 1 2 3 4 5 6 4 chunks +76 lines, -18 lines 0 comments Download
M media/base/audio_bus.h View 1 chunk +3 lines, -0 lines 0 comments Download
M media/base/audio_bus.cc View 1 2 3 4 1 chunk +10 lines, -0 lines 0 comments Download
M media/base/audio_bus_unittest.cc View 4 chunks +4 lines, -0 lines 0 comments Download

Messages

Total messages: 31 (8 generated)
qinmin
This CL moves the silence detection logic into WebAudio layer, PTAL.
5 years, 6 months ago (2015-06-18 22:32:38 UTC) #2
DaleCurtis
Looks like you didn't upload SilentAudioSink, but it looks like all the logic for silence ...
5 years, 6 months ago (2015-06-18 22:41:18 UTC) #3
qinmin
silent_audio_sink.h(cc) are attached. The problem to put everything inside render() is threading. Render() was called ...
5 years, 6 months ago (2015-06-18 23:38:05 UTC) #4
DaleCurtis
I don't follow, it shouldn't matter if the device thread has a message loop. This ...
5 years, 6 months ago (2015-06-19 01:08:20 UTC) #5
qinmin
On 2015/06/19 01:08:20, DaleCurtis wrote: > I don't follow, it shouldn't matter if the device ...
5 years, 6 months ago (2015-06-19 03:03:20 UTC) #6
DaleCurtis
On 2015/06/19 03:03:20, qinmin wrote: > On 2015/06/19 01:08:20, DaleCurtis wrote: > > I don't ...
5 years, 6 months ago (2015-06-19 17:41:56 UTC) #7
qinmin
On 2015/06/19 17:41:56, DaleCurtis wrote: > On 2015/06/19 03:03:20, qinmin wrote: > > On 2015/06/19 ...
5 years, 6 months ago (2015-06-19 17:51:12 UTC) #8
Raymond Toy
Do you have any numbers on how long it takes to resume when non-zero audio ...
5 years, 6 months ago (2015-06-19 17:51:40 UTC) #9
DaleCurtis
I don't think the timestamp helper is necessary and actually won't work because of delays ...
5 years, 6 months ago (2015-06-19 17:52:19 UTC) #10
DaleCurtis
Stop may be called on the main thread, but the Render() lock will be held: ...
5 years, 6 months ago (2015-06-19 17:53:46 UTC) #11
qinmin
On 2015/06/19 17:52:19, DaleCurtis wrote: > I don't think the timestamp helper is necessary and ...
5 years, 6 months ago (2015-06-19 18:10:55 UTC) #12
qinmin
PTAL again. Simplified the CL to use NullAudioSink and the assertion that Render() won't be ...
5 years, 6 months ago (2015-06-22 18:23:54 UTC) #13
DaleCurtis
https://codereview.chromium.org/1195633003/diff/40001/content/renderer/media/renderer_webaudiodevice_impl.cc File content/renderer/media/renderer_webaudiodevice_impl.cc (right): https://codereview.chromium.org/1195633003/diff/40001/content/renderer/media/renderer_webaudiodevice_impl.cc#newcode83 content/renderer/media/renderer_webaudiodevice_impl.cc:83: StopNullAudioSink(); Stop can be called multiple times, so I'd ...
5 years, 6 months ago (2015-06-22 19:14:41 UTC) #14
qinmin
https://codereview.chromium.org/1195633003/diff/40001/content/renderer/media/renderer_webaudiodevice_impl.cc File content/renderer/media/renderer_webaudiodevice_impl.cc (right): https://codereview.chromium.org/1195633003/diff/40001/content/renderer/media/renderer_webaudiodevice_impl.cc#newcode83 content/renderer/media/renderer_webaudiodevice_impl.cc:83: StopNullAudioSink(); On 2015/06/22 19:14:40, DaleCurtis wrote: > Stop can ...
5 years, 6 months ago (2015-06-22 22:23:16 UTC) #15
DaleCurtis
https://codereview.chromium.org/1195633003/diff/40001/content/renderer/media/renderer_webaudiodevice_impl.cc File content/renderer/media/renderer_webaudiodevice_impl.cc (right): https://codereview.chromium.org/1195633003/diff/40001/content/renderer/media/renderer_webaudiodevice_impl.cc#newcode118 content/renderer/media/renderer_webaudiodevice_impl.cc:118: audio_timestamp_helper_->AddFrames(dest->frames()); On 2015/06/22 22:23:16, qinmin wrote: > On 2015/06/22 ...
5 years, 6 months ago (2015-06-22 22:49:43 UTC) #16
qinmin
https://codereview.chromium.org/1195633003/diff/40001/content/renderer/media/renderer_webaudiodevice_impl.cc File content/renderer/media/renderer_webaudiodevice_impl.cc (right): https://codereview.chromium.org/1195633003/diff/40001/content/renderer/media/renderer_webaudiodevice_impl.cc#newcode118 content/renderer/media/renderer_webaudiodevice_impl.cc:118: audio_timestamp_helper_->AddFrames(dest->frames()); On 2015/06/22 22:49:42, DaleCurtis wrote: > On 2015/06/22 ...
5 years, 6 months ago (2015-06-23 00:01:54 UTC) #17
DaleCurtis
lgtm % some minor fixes. Thanks for doing this Qinmin! https://codereview.chromium.org/1195633003/diff/40001/content/renderer/media/renderer_webaudiodevice_impl.cc File content/renderer/media/renderer_webaudiodevice_impl.cc (right): https://codereview.chromium.org/1195633003/diff/40001/content/renderer/media/renderer_webaudiodevice_impl.cc#newcode118 ...
5 years, 6 months ago (2015-06-23 16:38:14 UTC) #18
qinmin
https://codereview.chromium.org/1195633003/diff/80001/content/renderer/media/renderer_webaudiodevice_impl.cc File content/renderer/media/renderer_webaudiodevice_impl.cc (right): https://codereview.chromium.org/1195633003/diff/80001/content/renderer/media/renderer_webaudiodevice_impl.cc#newcode81 content/renderer/media/renderer_webaudiodevice_impl.cc:81: is_using_null_audio_sink_ = false; On 2015/06/23 16:38:14, DaleCurtis wrote: > ...
5 years, 6 months ago (2015-06-23 18:15:57 UTC) #19
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1195633003/100001
5 years, 6 months ago (2015-06-23 18:22:01 UTC) #24
commit-bot: I haz the power
Exceeded global retry quota
5 years, 6 months ago (2015-06-23 18:52:40 UTC) #26
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1195633003/120001
5 years, 6 months ago (2015-06-23 21:43:07 UTC) #29
commit-bot: I haz the power
Committed patchset #7 (id:120001)
5 years, 6 months ago (2015-06-23 23:17:30 UTC) #30
commit-bot: I haz the power
5 years, 6 months ago (2015-06-23 23:18:19 UTC) #31
Message was sent while issue was closed.
Patchset 7 (id:??) landed as
https://crrev.com/bda540eb1cbfd36dda3eec0206913331ca1ab822
Cr-Commit-Position: refs/heads/master@{#335799}

Powered by Google App Engine
This is Rietveld 408576698