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

Issue 2578983003: Add AudioStreamRegistry. Move stream counting logic (Closed)

Created:
4 years ago by Max Morin
Modified:
3 years, 10 months ago
Reviewers:
DaleCurtis, o1ka
CC:
chromium-reviews, creis+watch_chromium.org, darin-cc_chromium.org, feature-media-reviews_chromium.org, jam, miu+watch_chromium.org, nasko+codewatch_chromium.org, posciak+watch_chromium.org, xjz+watch_chromium.org
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Add AudioStreamRegistry. Move stream counting logic from AudioRendererHost to AudioStreamRegistry. AudioStreamRegistry lives in RendererProcessHost and is passed through AudioRendererHost to AudioDelegate. BUG=670383 CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel

Patch Set 1 #

Patch Set 2 : Thread checking. #

Total comments: 10

Patch Set 3 : Some improvements. Tests. #

Patch Set 4 : Fix BUILDFLAG(ENABLE_WEBRTC) handling. #

Patch Set 5 : Removed stale declaration in ARH. #

Patch Set 6 : Add missing EXPECT_TRUE. #

Total comments: 17

Patch Set 7 : Thread checks. #

Total comments: 3

Patch Set 8 : Remove debug recording code. #

Patch Set 9 : Also test histogram logging. #

Patch Set 10 : . #

Total comments: 5

Patch Set 11 : Remove active audio tracking from ARH to see what tests break. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+390 lines, -97 lines) Patch
M content/browser/BUILD.gn View 1 2 3 4 5 6 7 8 9 10 1 chunk +3 lines, -0 lines 0 comments Download
M content/browser/renderer_host/media/audio_input_renderer_host_unittest.cc View 1 2 3 4 5 6 7 8 9 10 1 chunk +2 lines, -0 lines 0 comments Download
M content/browser/renderer_host/media/audio_renderer_host.h View 1 2 3 4 5 6 7 8 9 7 chunks +3 lines, -16 lines 0 comments Download
M content/browser/renderer_host/media/audio_renderer_host.cc View 1 2 3 4 5 6 7 8 9 10 chunks +11 lines, -66 lines 0 comments Download
M content/browser/renderer_host/media/audio_renderer_host_unittest.cc View 1 2 3 4 5 6 7 8 9 8 chunks +21 lines, -5 lines 0 comments Download
A content/browser/renderer_host/media/audio_stream_registry.h View 1 2 3 4 5 6 7 1 chunk +24 lines, -0 lines 0 comments Download
A content/browser/renderer_host/media/audio_stream_registry_impl.h View 1 2 3 4 5 6 7 1 chunk +49 lines, -0 lines 0 comments Download
A content/browser/renderer_host/media/audio_stream_registry_impl.cc View 1 2 3 4 5 6 7 8 9 10 1 chunk +106 lines, -0 lines 0 comments Download
A content/browser/renderer_host/media/audio_stream_registry_impl_unittest.cc View 1 2 3 4 5 6 7 8 9 10 1 chunk +144 lines, -0 lines 0 comments Download
M content/browser/renderer_host/render_process_host_impl.h View 1 2 3 4 5 6 7 3 chunks +5 lines, -0 lines 0 comments Download
M content/browser/renderer_host/render_process_host_impl.cc View 1 2 3 4 5 6 7 5 chunks +6 lines, -5 lines 0 comments Download
M content/public/test/mock_render_process_host.h View 1 2 3 4 5 6 7 3 chunks +7 lines, -0 lines 0 comments Download
M content/public/test/mock_render_process_host.cc View 1 2 3 4 5 6 7 8 9 10 1 chunk +4 lines, -1 line 0 comments Download
M content/test/BUILD.gn View 1 2 3 4 5 6 7 8 9 10 1 chunk +1 line, -0 lines 0 comments Download
M media/audio/audio_streams_tracker.h View 1 2 3 4 5 6 7 8 1 chunk +1 line, -1 line 0 comments Download
M media/audio/audio_streams_tracker.cc View 1 2 3 4 5 6 7 8 1 chunk +3 lines, -3 lines 0 comments Download

Messages

Total messages: 33 (10 generated)
Max Morin
Olga: WDYT of this approach? If you think it makes sense, tests will have to ...
4 years ago (2016-12-15 13:22:25 UTC) #4
o1ka
Yes - that's what we need. Looks good! https://codereview.chromium.org/2578983003/diff/20001/content/browser/renderer_host/media/audio_stream_registry_impl.cc File content/browser/renderer_host/media/audio_stream_registry_impl.cc (right): https://codereview.chromium.org/2578983003/diff/20001/content/browser/renderer_host/media/audio_stream_registry_impl.cc#newcode57 content/browser/renderer_host/media/audio_stream_registry_impl.cc:57: output_streams_.insert(stream); ...
4 years ago (2016-12-16 09:48:16 UTC) #5
Henrik Grunell
On 2016/12/15 13:22:25, Max Morin OOO 22 Dec - 9 Jan wrote: > Olga: WDYT ...
4 years ago (2016-12-16 09:52:48 UTC) #6
Max Morin
I added debug recording stubs in AudioOutputDelegate. PTAL (no hurry, I don't intend to land ...
4 years ago (2016-12-19 16:29:03 UTC) #8
Henrik Grunell
On 2016/12/19 16:29:03, Max Morin OOO 22 Dec - 9 Jan wrote: > I added ...
4 years ago (2016-12-21 10:39:12 UTC) #9
o1ka
https://codereview.chromium.org/2578983003/diff/100001/content/browser/renderer_host/media/audio_output_delegate.h File content/browser/renderer_host/media/audio_output_delegate.h (right): https://codereview.chromium.org/2578983003/diff/100001/content/browser/renderer_host/media/audio_output_delegate.h#newcode100 content/browser/renderer_host/media/audio_output_delegate.h:100: void EnableDebugRecording(const base::FilePath& base_file_name) override; Oh, I just realized. ...
4 years ago (2016-12-22 10:46:52 UTC) #10
Max Morin
https://codereview.chromium.org/2578983003/diff/100001/content/browser/renderer_host/media/audio_output_delegate.h File content/browser/renderer_host/media/audio_output_delegate.h (right): https://codereview.chromium.org/2578983003/diff/100001/content/browser/renderer_host/media/audio_output_delegate.h#newcode100 content/browser/renderer_host/media/audio_output_delegate.h:100: void EnableDebugRecording(const base::FilePath& base_file_name) override; I think AudioStreamRegistry will ...
3 years, 11 months ago (2017-01-09 15:34:23 UTC) #11
o1ka
https://codereview.chromium.org/2578983003/diff/100001/content/browser/renderer_host/media/audio_output_delegate.h File content/browser/renderer_host/media/audio_output_delegate.h (right): https://codereview.chromium.org/2578983003/diff/100001/content/browser/renderer_host/media/audio_output_delegate.h#newcode100 content/browser/renderer_host/media/audio_output_delegate.h:100: void EnableDebugRecording(const base::FilePath& base_file_name) override; On 2017/01/09 15:34:23, Max ...
3 years, 11 months ago (2017-01-10 11:47:40 UTC) #12
Max Morin
Much simpler now! Also, I added tests for the histograms since they are an important ...
3 years, 11 months ago (2017-01-12 12:42:21 UTC) #13
Max Morin
PTAL.
3 years, 11 months ago (2017-01-12 13:52:59 UTC) #14
o1ka
Nice and simple :) lgtm https://codereview.chromium.org/2578983003/diff/180001/content/browser/renderer_host/render_process_host_impl.h File content/browser/renderer_host/render_process_host_impl.h (right): https://codereview.chromium.org/2578983003/diff/180001/content/browser/renderer_host/render_process_host_impl.h#newcode550 content/browser/renderer_host/render_process_host_impl.h:550: const AudioStreamRegistryImpl::UniquePtr audio_stream_registry_; "Must ...
3 years, 11 months ago (2017-01-12 18:09:46 UTC) #15
DaleCurtis
https://codereview.chromium.org/2578983003/diff/180001/content/browser/renderer_host/media/audio_renderer_host.cc File content/browser/renderer_host/media/audio_renderer_host.cc (right): https://codereview.chromium.org/2578983003/diff/180001/content/browser/renderer_host/media/audio_renderer_host.cc#newcode319 content/browser/renderer_host/media/audio_renderer_host.cc:319: stream_registry_->RegisterStream(); Typically we'd return a bound id or something ...
3 years, 11 months ago (2017-01-12 19:22:12 UTC) #17
DaleCurtis
In case my comment is a bit buried: this is a nice cleanup, but I ...
3 years, 11 months ago (2017-01-12 19:23:04 UTC) #18
Max Morin
On 2017/01/12 19:23:04, DaleCurtis wrote: > In case my comment is a bit buried: this ...
3 years, 11 months ago (2017-01-16 14:43:16 UTC) #23
DaleCurtis
On 2017/01/16 at 14:43:16, maxmorin wrote: > On 2017/01/12 19:23:04, DaleCurtis wrote: > > In ...
3 years, 11 months ago (2017-01-17 19:15:01 UTC) #24
Max Morin
On 2017/01/17 19:15:01, DaleCurtis wrote: > On 2017/01/16 at 14:43:16, maxmorin wrote: > > On ...
3 years, 11 months ago (2017-01-18 16:27:39 UTC) #25
DaleCurtis
Sorry I didn't explain correctly / clearly. Stream counts can move into AudioStreamMonitor as a ...
3 years, 11 months ago (2017-01-18 20:19:46 UTC) #26
Max Morin
I'm afraid I still don't get it at all. :) On 2017/01/18 20:19:46, DaleCurtis wrote: ...
3 years, 11 months ago (2017-01-25 17:35:23 UTC) #27
DaleCurtis
On 2017/01/25 at 17:35:23, maxmorin wrote: > I'm afraid I still don't get it at ...
3 years, 11 months ago (2017-01-25 22:49:12 UTC) #28
Max Morin
On 2017/01/25 22:49:12, DaleCurtis wrote: > On 2017/01/25 at 17:35:23, maxmorin wrote: > > I'm ...
3 years, 11 months ago (2017-01-26 16:09:18 UTC) #29
o1ka
> I think instead all of this can be deleted. AudioStreamMonitor contains > everything needed ...
3 years, 10 months ago (2017-01-27 12:43:44 UTC) #30
DaleCurtis
On 2017/01/27 at 12:43:44, olka wrote: > > I think instead all of this can ...
3 years, 10 months ago (2017-01-27 20:30:01 UTC) #31
o1ka
3 years, 10 months ago (2017-01-30 16:15:05 UTC) #32
On 2017/01/27 20:30:01, DaleCurtis wrote:
> On 2017/01/27 at 12:43:44, olka wrote:
> > > I think instead all of this can be deleted. AudioStreamMonitor contains
> > > everything needed to handle these cases now I think. It's notified when
new
> > > streams are added and fans out notifications when audio starts/stops.
> > > 
> > 
> > This is how I see it:
> > 
> > We have 2 entities interested in audio stream states:
> > 1) RendererProcessHost needs to know if a renderer can go to background,
which
> is possible if there are no active audio streams. AudioStreamTracker
aggregates
> this information for RPH.
> > 2) AudioStreamMonitor needs to know if it should be polling a stream for
audio
> volume levels; this information is aggregated per WebContents.
> > 
> > AudioStreamMonitor is basically "WebContentsAudioPowerMonitor".
> > AudioStreamTracker is "RendererAudioStreamTracker".
> > 
> > They can be considered as two subscribers for stream state change
> notifications, and they use these notifications for different purposes and
> aggregate information on different levels.
> > 
> > I don't think we should combine these two entities, it will complicate the
> code and object relations.
> > 
> > In the future we may figure out a more unified way to subscribe for stream
> state changes - we will actually have to, before switching to a separate
> process.
> > 
> > Am I missing something?
> 
> I agree with your points 1+2, but I disagree with your conclusion. Read
another
> way, why should we have 3 classes which all count streams in subtly different
> ways? As written we have monitor, tracker, and registry which feels fairly
> absurd from a complexity standpoint. Their current functionality is not ideal
> either; thus my proposal above which gets us closer to the ideal functionality
> with fewer classes. I also don't think my proposal complicated class
> functionality at all. Apologies for not being able to get the core of my point
> across more clearly, so I just wrote one way this could be done:
> https://codereview.chromium.org/2655413004

Thanks for making a CL! Now I see what you mean. Looks like we were missing
understanding how RPH and WebContents are related.

Powered by Google App Engine
This is Rietveld 408576698