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

Issue 8283032: Low-latency AudioInputStream implementation based on WASAPI for Windows. (Closed)

Created:
9 years, 2 months ago by henrika (OOO until Aug 14)
Modified:
9 years, 1 month ago
CC:
chromium-reviews, hclam+watch_chromium.org, ddorwin+watch_chromium.org, fischman+watch_chromium.org, Paweł Hajdan Jr., acolwell+watch_chromium.org, annacc+watch_chromium.org, ajwong+watch_chromium.org, vrk (LEFT CHROMIUM), brettw-cc_chromium.org, scherkus (not reviewing), Raymond Toy (Google), enal, Satish
Visibility:
Public.

Description

Low-latency AudioInputStream implementation based on WASAPI for Windows. Requires Windows Vista or higher. BUG=none TEST=Attached unit test (requires undefined CHROME_HEADLESS) Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=106899

Patch Set 1 #

Total comments: 57

Patch Set 2 : Changes based on first round of reviews #

Patch Set 3 : Reduced lint errors #

Patch Set 4 : Added ViewHostMsg_GetHardwareInputSampleRate IPC message #

Total comments: 4

Patch Set 5 : Added DISABLED_ to last unit test #

Patch Set 6 : Fixed minor compile issue on Mac #

Patch Set 7 : Added MMCSS support (loads avrt.dll) #

Total comments: 6

Patch Set 8 : Fixes in AVRT wrapper based on review by tommi #

Total comments: 58

Patch Set 9 : Incorporates changes based on review by Andrew and Chris #

Patch Set 10 : Minor lint fix #

Total comments: 20

Patch Set 11 : Now uses ScopedCoMem in base/win #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+1293 lines, -35 lines) Patch
M base/threading/platform_thread_win.cc View 1 2 3 4 5 6 7 8 9 10 1 chunk +13 lines, -3 lines 1 comment Download
M content/browser/renderer_host/render_message_filter.h View 1 2 3 4 5 6 7 8 9 10 1 chunk +1 line, -0 lines 0 comments Download
M content/browser/renderer_host/render_message_filter.cc View 1 2 3 4 5 6 7 8 9 10 2 chunks +6 lines, -0 lines 0 comments Download
M content/common/view_messages.h View 1 2 3 4 5 6 7 8 9 10 1 chunk +4 lines, -0 lines 0 comments Download
M content/renderer/media/audio_input_device.cc View 1 2 3 4 5 6 7 8 9 10 1 chunk +4 lines, -0 lines 0 comments Download
M content/renderer/media/webrtc_audio_device_impl.cc View 1 2 3 4 5 6 7 8 9 10 8 chunks +45 lines, -24 lines 0 comments Download
M media/audio/audio_util.h View 1 2 3 4 5 6 7 8 9 10 1 chunk +4 lines, -1 line 0 comments Download
M media/audio/audio_util.cc View 1 2 3 4 5 6 7 8 9 10 3 chunks +30 lines, -2 lines 0 comments Download
A media/audio/win/audio_low_latency_input_win.h View 1 2 3 4 5 6 7 8 9 10 1 chunk +182 lines, -0 lines 0 comments Download
A media/audio/win/audio_low_latency_input_win.cc View 1 2 3 4 5 6 7 8 9 10 1 chunk +511 lines, -0 lines 0 comments Download
A media/audio/win/audio_low_latency_input_win_unittest.cc View 1 2 3 4 5 6 7 8 9 10 1 chunk +368 lines, -0 lines 0 comments Download
M media/audio/win/audio_manager_win.h View 1 2 3 4 5 6 7 8 9 10 3 chunks +4 lines, -4 lines 0 comments Download
M media/audio/win/audio_manager_win.cc View 1 2 3 4 5 6 7 8 9 10 3 chunks +13 lines, -1 line 0 comments Download
A media/audio/win/avrt_wrapper_win.h View 1 2 3 4 5 6 7 8 9 10 1 chunk +39 lines, -0 lines 0 comments Download
A media/audio/win/avrt_wrapper_win.cc View 1 2 3 4 5 6 7 8 1 chunk +64 lines, -0 lines 0 comments Download
M media/media.gyp View 1 2 3 4 5 6 7 8 9 10 3 chunks +5 lines, -0 lines 0 comments Download

Messages

Total messages: 34 (0 generated)
henrika (OOO until Aug 14)
This is a non-trivial patch for support of low-latency audio on Windows Vista and higher. ...
9 years, 2 months ago (2011-10-14 13:52:43 UTC) #1
tommi (sloooow) - chröme
Overall this looks very good. http://codereview.chromium.org/8283032/diff/1/base/threading/platform_thread_win.cc File base/threading/platform_thread_win.cc (right): http://codereview.chromium.org/8283032/diff/1/base/threading/platform_thread_win.cc#newcode168 base/threading/platform_thread_win.cc:168: break; should we have ...
9 years, 2 months ago (2011-10-14 14:31:04 UTC) #2
Niklas Enbom
Had a quick check, looks good. Let's talk through if the delay calculation can be ...
9 years, 2 months ago (2011-10-14 14:46:50 UTC) #3
henrika (OOO until Aug 14)
Changes based on first review round by niklase and tommi. Thanks. http://codereview.chromium.org/8283032/diff/1/base/threading/platform_thread_win.cc File base/threading/platform_thread_win.cc (right): ...
9 years, 2 months ago (2011-10-17 12:08:24 UTC) #4
henrika (OOO until Aug 14)
A new IPC message has been added to query the native input sample rate. These ...
9 years, 2 months ago (2011-10-18 07:51:36 UTC) #5
henrika (OOO until Aug 14)
and content/common/view_messages.h
9 years, 2 months ago (2011-10-18 07:53:58 UTC) #6
henrika (OOO until Aug 14)
Added some clarifying comments inline. http://codereview.chromium.org/8283032/diff/15001/content/renderer/media/audio_input_device.cc File content/renderer/media/audio_input_device.cc (right): http://codereview.chromium.org/8283032/diff/15001/content/renderer/media/audio_input_device.cc#newcode34 content/renderer/media/audio_input_device.cc:34: // Use Core Audio ...
9 years, 2 months ago (2011-10-18 08:13:13 UTC) #7
henrika (OOO until Aug 14)
Next step is to add support for MMCSS (thread priority boosting).
9 years, 2 months ago (2011-10-18 09:15:01 UTC) #8
henrika (OOO until Aug 14)
Patch Set 7 adds MMCSS support. Adds media/audio/win/avrt_wrapper_win.h/.cc and modifies media/audio/win/audio_low_latency_input_win.h/.cc. Tommi is the perfect ...
9 years, 2 months ago (2011-10-18 13:34:07 UTC) #9
tommi
lgtm for the avrt wrapper with a couple of nits. http://codereview.chromium.org/8283032/diff/17027/media/audio/win/avrt_wrapper_win.cc File media/audio/win/avrt_wrapper_win.cc (right): http://codereview.chromium.org/8283032/diff/17027/media/audio/win/avrt_wrapper_win.cc#newcode9 ...
9 years, 2 months ago (2011-10-18 14:14:10 UTC) #10
henrika (OOO until Aug 14)
Avrt fixes based on review from tommi. Waiting for feedback from: - crogers - scherkus ...
9 years, 2 months ago (2011-10-18 14:56:49 UTC) #11
henrika (OOO until Aug 14)
+satish
9 years, 2 months ago (2011-10-18 15:02:42 UTC) #12
jam
content/browser and content/common lgtm
9 years, 2 months ago (2011-10-18 18:13:21 UTC) #13
scherkus (not reviewing)
mostly nits but looking good http://codereview.chromium.org/8283032/diff/21008/content/renderer/media/audio_input_device.cc File content/renderer/media/audio_input_device.cc (right): http://codereview.chromium.org/8283032/diff/21008/content/renderer/media/audio_input_device.cc#newcode34 content/renderer/media/audio_input_device.cc:34: // Use Core Audio ...
9 years, 2 months ago (2011-10-18 21:12:30 UTC) #14
Chris Rogers
Really happy to see this, along with the thread priority stuff! One question I have ...
9 years, 2 months ago (2011-10-19 00:55:18 UTC) #15
scherkus (not reviewing)
yeah we might be able to implement the windows base/ version of kThreadPriority_RealtimeAudio using Avrt ...
9 years, 2 months ago (2011-10-19 01:20:31 UTC) #16
tommi (sloooow) - chröme
Re the avrt class vs namespace comment. Changing to a namespace makes sense. I suggested ...
9 years, 2 months ago (2011-10-19 09:09:14 UTC) #17
henrika (OOO until Aug 14)
Did modifications based on review by Chris and Andrew. The AvrtWrapper class is now a ...
9 years, 2 months ago (2011-10-19 15:42:42 UTC) #18
scherkus (not reviewing)
LGTM w/ some nits we'll have to sort out that ScopedCoMem thing in a later ...
9 years, 2 months ago (2011-10-19 17:15:55 UTC) #19
Chris Rogers
Please add a TODO around the Avrt stuff to remind us to do this unification/refactoring ...
9 years, 2 months ago (2011-10-19 17:32:40 UTC) #20
Chris Rogers
Please put a TODO in the code, so we don't forget for later re-factoring. Even ...
9 years, 2 months ago (2011-10-19 17:35:48 UTC) #21
tommi (sloooow) - chröme
I found a couple of issues below. Please check if there are more cases of ...
9 years, 2 months ago (2011-10-19 20:15:37 UTC) #22
henrika (OOO until Aug 14)
I believe I've covered all input now. Chris, I've added a TODO as requested but ...
9 years, 2 months ago (2011-10-21 10:31:37 UTC) #23
henrika (OOO until Aug 14)
FYI, the trybots are actually green. I used an incorrect revision in the tests above.
9 years, 2 months ago (2011-10-21 14:21:43 UTC) #24
Chris Rogers
Thanks Henrik - LGTM generally overall I'm assuming Tommi has looked closely at the nitty-gritty ...
9 years, 2 months ago (2011-10-21 17:43:03 UTC) #25
willchan no longer on Chromium
Post-commit base/OWNERS lgtm, although I put a caveat in there. http://codereview.chromium.org/8283032/diff/34001/base/threading/platform_thread_win.cc File base/threading/platform_thread_win.cc (right): http://codereview.chromium.org/8283032/diff/34001/base/threading/platform_thread_win.cc#newcode166 ...
9 years, 1 month ago (2011-10-25 20:26:26 UTC) #26
henrika_dont_use
Hi William, thanks for the fast review and sorry for not asking as I should ...
9 years, 1 month ago (2011-10-25 20:47:13 UTC) #27
tommi (sloooow) - chröme
[-google address] If I understand correctly, there's now a base->audio boundary breach whereas it should ...
9 years, 1 month ago (2011-10-25 21:07:35 UTC) #28
Chris Rogers
On 2011/10/25 20:26:26, willchan wrote: > Post-commit base/OWNERS lgtm, although I put a caveat in ...
9 years, 1 month ago (2011-10-25 21:14:11 UTC) #29
willchan no longer on Chromium
On Tue, Oct 25, 2011 at 2:14 PM, <crogers@google.com> wrote: > On 2011/10/25 20:26:26, willchan ...
9 years, 1 month ago (2011-10-25 21:38:08 UTC) #30
Chris Rogers
On 2011/10/25 21:38:08, willchan wrote: > > I don't doubt there's a need to support ...
9 years, 1 month ago (2011-10-25 21:53:33 UTC) #31
willchan no longer on Chromium
Just to be clear, I've already sent the LGTM for this specific change. I'm just ...
9 years, 1 month ago (2011-10-25 22:09:10 UTC) #32
Chris Rogers
On 2011/10/25 22:09:10, willchan wrote: > Just to be clear, I've already sent the LGTM ...
9 years, 1 month ago (2011-10-25 22:25:41 UTC) #33
willchan no longer on Chromium
9 years, 1 month ago (2011-10-25 22:39:45 UTC) #34
On Tue, Oct 25, 2011 at 3:25 PM, <crogers@google.com> wrote:

> On 2011/10/25 22:09:10, willchan wrote:
>
>> Just to be clear, I've already sent the LGTM for this specific change. I'm
>> just questioning the previous decision.
>>
>
>  On Tue, Oct 25, 2011 at 2:53 PM, <mailto:crogers@google.com> wrote:
>>
>
>  > On 2011/10/25 21:38:08, willchan wrote:
>> >
>> >  I don't doubt there's a need to support these capabilities in
>> >> PlatformThread. I just don't think there should be any mention of
>> >> media/audio in base/. None of the platform specific APIs have any
>> mention
>> >> of
>> >> media/audio, so why do our base/ APIs? Why can't this just be
>> >> kThreadPriority_Realtime or kThreadPriority_Critical or something? And
>> >> perhaps provide a thread policy struct that is optionally used if the
>> OS
>> >> supports it. It looks SO UGLY that platform_thread_mac.mm has all
>> these
>> >> audio specific constants. That should be calculated at a higher level
>> and
>> >> then specified via an abstract thread policy API, similar to the
>> >> thread_policy_set() function provided on OS X. We should respect
>> layering
>> >> boundaries.
>> >>
>> >
>> > I'm not opposed to changing the name of the constant to something like:
>> > kThreadPriority_Realtime or kThreadPriority_Critical as you suggest,
>> > although I
>> > think it's better to have "Audio" or "Media" in the constant name
>> because
>> > both
>> > Mac OS X and Windows support specific "audio/media" priority levels,
>> which
>> > is
>> > what we're interested in.
>> >
>>
>
>  Interesting, that's news to me. Can you send me a link? I see Mac has
>> realtime threads (
>>
>
> http://developer.apple.com/**library/mac/#documentation/**
>
Darwin/Conceptual/**KernelProgramming/scheduler/**scheduler.html<http://developer.apple.com/library/mac/#documentation/Darwin/Conceptual/KernelProgramming/scheduler/scheduler.html>
> )
>
>> and Windows doesn't seem to have anything like that (
>>
>
> http://msdn.microsoft.com/en-**us/library/windows/desktop/**
>
ms686277%28v=vs.85%29.aspx<http://msdn.microsoft.com/en-us/library/windows/desktop/ms686277%28v=vs.85%29.aspx>
> ).
>
>  If this concept is indeed supported in our 3 main platforms, then I am
>> significantly more open to this.
>>
>
> Henrik's MMCSS code is intended to set to a "media" thread priority.  MMCSS
> deals with the concept of media.  I don't know that Linux has a specific
> "media"
> level thread priority, but I'm sure we can find something that's
> appropriate for
> media there.
>
>
>
>
>
>
>  >
>> > Your suggestion about adding abstract thread constraints policy API  was
>> > brought
>> > up and discussed quite a bit in the code review itself (and in offline
>> > conversations).
>> >
>>
>
>
> http://codereview.chromium.**org/6949009/diff/15001/base/**
>
threading/platform_thread.h#**newcode54<http://codereview.chromium.org/6949009/diff/15001/base/threading/platform_thread.h#newcode54>
>
>> seems
>> to have the discussion, although it didn't seem very extensive. Darin
>> doesn't seem to have replied at all after his initial concern.
>>
>
> Sorry, we had offline discussions.
>
>
>
>
>
>  > The conclusion we came to is that it's only Mac OS X which even deals in
>> > these
>> > policies, and the other OS APIs do not even have these concepts.
>> >  Therefore, it
>> > would not make sense to create such an abstract thread constraints
>> policy
>> > API.
>> >
>>
>
>  OK, then how about exposing the OS X specific API in a #if
>> defined(OS_MACOSX) block in platform_thread.h? Why are we letting a OS X
>> specific feature dictate that we have to provide a new cross-platform
>> priority level, that has no cross-platform meaning?
>>
>
> I don't agree with you there.  Both Windows and Mac OS X specifically have
> the
> concept of media priority threads.  Perhaps Linux doesn't directly, but we
> can
> do something that makes sense there.


> In any case, I think we've hijacked this code review thread which has
> little to
> do with this current discussion.
>

Fair enough. Moving off thread.


>
>
>
>
http://codereview.chromium.**org/8283032/<http://codereview.chromium.org/8283...
>

Powered by Google App Engine
This is Rietveld 408576698