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

Issue 8477037: Simplify AudioRendererImpl by using AudioDevice. (Closed)

Created:
9 years, 1 month ago by Chris Rogers
Modified:
9 years ago
CC:
chromium-reviews, hclam+watch_chromium.org, ddorwin+watch_chromium.org, fischman+watch_chromium.org, jam, acolwell+watch_chromium.org, annacc+watch_chromium.org, dpranke-watch+content_chromium.org, joi+watch-content_chromium.org, darin-cc_chromium.org, ajwong+watch_chromium.org, scherkus (not reviewing), ihf+watch_chromium.org
Visibility:
Public.

Description

Simplify AudioRendererImpl by using AudioDevice. This helps us move closer to being able to do renderer-side mixing, for improved performance. BUG=none TEST=audio_renderer_impl_unittest (also verified that the media layout tests all pass, and did manual testing with several audio files and YouTube videos)

Patch Set 1 #

Total comments: 72

Patch Set 2 : '' #

Total comments: 1

Patch Set 3 : '' #

Patch Set 4 : '' #

Total comments: 15

Patch Set 5 : '' #

Patch Set 6 : '' #

Total comments: 18
Unified diffs Side-by-side diffs Delta from patch set Stats (+349 lines, -643 lines) Patch
M content/renderer/media/audio_device.h View 1 2 3 4 7 chunks +67 lines, -11 lines 0 comments Download
M content/renderer/media/audio_device.cc View 1 2 3 4 5 11 chunks +139 lines, -32 lines 16 comments Download
M content/renderer/media/audio_renderer_impl.h View 1 2 3 4 6 chunks +25 lines, -125 lines 0 comments Download
M content/renderer/media/audio_renderer_impl.cc View 1 2 3 4 3 chunks +109 lines, -387 lines 0 comments Download
M content/renderer/media/audio_renderer_impl_unittest.cc View 1 2 3 4 8 chunks +4 lines, -86 lines 0 comments Download
M media/filters/audio_renderer_base.cc View 1 2 3 4 1 chunk +5 lines, -2 lines 2 comments Download

Messages

Total messages: 45 (0 generated)
Chris Rogers
I've tested this a fair bit on a variety of audio files, and tried many ...
9 years, 1 month ago (2011-11-07 20:48:48 UTC) #1
Chris Rogers
By the way, the changes to audio_renderer_impl.cc are so significant, that it may be difficult ...
9 years, 1 month ago (2011-11-07 20:50:48 UTC) #2
henrika (OOO until Aug 14)
Feels like a good idea to merge; thanks Chris. I will focus on the AudioDevice ...
9 years, 1 month ago (2011-11-08 08:11:56 UTC) #3
Chris Rogers
Henrik, thanks for having a look. It seems like both your and Tommi's patches are ...
9 years, 1 month ago (2011-11-08 18:50:30 UTC) #4
acolwell GONE FROM CHROMIUM
Overall I think this is looking pretty good. You should definitely get enal@ to review ...
9 years, 1 month ago (2011-11-08 21:44:20 UTC) #5
scherkus (not reviewing)
http://codereview.chromium.org/8477037/diff/1/content/renderer/media/audio_device.cc File content/renderer/media/audio_device.cc (right): http://codereview.chromium.org/8477037/diff/1/content/renderer/media/audio_device.cc#newcode18 content/renderer/media/audio_device.cc:18: : buffer_size_(0), indent by two more http://codereview.chromium.org/8477037/diff/1/content/renderer/media/audio_device.cc#newcode53 content/renderer/media/audio_device.cc:53: CHECK_EQ(0, ...
9 years, 1 month ago (2011-11-09 02:39:04 UTC) #6
henrika (OOO until Aug 14)
Focused on the AudioDevice parts. I see some potential race issues but otherwise it looks ...
9 years, 1 month ago (2011-11-09 17:05:22 UTC) #7
Chris Rogers
Everybody, thanks for your comments. I've tried to respond to them all. http://codereview.chromium.org/8477037/diff/1/content/renderer/media/audio_device.cc File content/renderer/media/audio_device.cc ...
9 years, 1 month ago (2011-11-10 02:17:22 UTC) #8
henrika (OOO until Aug 14)
Answered questions from Chris. http://codereview.chromium.org/8477037/diff/1/content/renderer/media/audio_device.cc File content/renderer/media/audio_device.cc (right): http://codereview.chromium.org/8477037/diff/1/content/renderer/media/audio_device.cc#newcode139 content/renderer/media/audio_device.cc:139: void AudioDevice::Pause(bool flush) { Fine ...
9 years, 1 month ago (2011-11-10 11:45:07 UTC) #9
henrika (OOO until Aug 14)
Added one more nit. I could give OK here but assume that you will add ...
9 years, 1 month ago (2011-11-10 11:50:24 UTC) #10
acolwell GONE FROM CHROMIUM
Looking good. Just a few more questions/comments. http://codereview.chromium.org/8477037/diff/1/content/renderer/media/audio_device.cc File content/renderer/media/audio_device.cc (left): http://codereview.chromium.org/8477037/diff/1/content/renderer/media/audio_device.cc#oldcode215 content/renderer/media/audio_device.cc:215: (pending_data >= ...
9 years, 1 month ago (2011-11-10 21:58:15 UTC) #11
Chris Rogers
Henrik and Aaron, thanks again for your comments. I think I've answered them all. media ...
9 years, 1 month ago (2011-11-15 22:48:29 UTC) #12
acolwell GONE FROM CHROMIUM
Looks good Chris just 2 final comments and I think it'll be ready for checkin. ...
9 years, 1 month ago (2011-11-16 06:41:04 UTC) #13
henrika (OOO until Aug 14)
Chris, I have added some minor comments. The lock seems OK. Feels like "nice to ...
9 years, 1 month ago (2011-11-16 20:48:02 UTC) #14
Chris Rogers
Latest patch addresses all comments. Henrik, I ran the WebRTC content test on Mac OS ...
9 years, 1 month ago (2011-11-17 02:37:29 UTC) #15
henrika (OOO until Aug 14)
LGTM ;-) "Henrik, I ran the WebRTC content test on Mac OS X, but a ...
9 years, 1 month ago (2011-11-17 12:15:31 UTC) #16
henrika (OOO until Aug 14)
FYI - I did not review the unit test for AudioRenderImpl since I don't know ...
9 years, 1 month ago (2011-11-17 12:16:49 UTC) #17
acolwell GONE FROM CHROMIUM
http://codereview.chromium.org/8477037/diff/16003/content/renderer/media/audio_renderer_impl.cc File content/renderer/media/audio_renderer_impl.cc (right): http://codereview.chromium.org/8477037/diff/16003/content/renderer/media/audio_renderer_impl.cc#newcode212 content/renderer/media/audio_renderer_impl.cc:212: if (stopped_) On 2011/11/17 02:37:30, Chris Rogers wrote: > ...
9 years, 1 month ago (2011-11-17 19:16:12 UTC) #18
vrk (LEFT CHROMIUM)
Taking over crogers' CL since he's on vacation! Looks like the MessageLoop DestructionObserver was introduced ...
9 years, 1 month ago (2011-11-22 01:17:39 UTC) #19
no longer working on chromium
Great work. Some little concerns on AudioDevice. BR, /SX
9 years ago (2011-11-28 15:17:17 UTC) #20
no longer working on chromium
http://codereview.chromium.org/8477037/diff/29001/content/renderer/media/audio_device.cc File content/renderer/media/audio_device.cc (right): http://codereview.chromium.org/8477037/diff/29001/content/renderer/media/audio_device.cc#newcode117 content/renderer/media/audio_device.cc:117: base::Bind(&AudioDevice::ShutDownOnIOThread, this, &completion)); We use a WitableEvent in ShutDownOnIOThread() ...
9 years ago (2011-11-28 15:17:41 UTC) #21
vrk (LEFT CHROMIUM)
D'oh, unfortunately one cannot add patches to a CL one does not own... Please take ...
9 years ago (2011-12-02 22:54:45 UTC) #22
vrk (LEFT CHROMIUM)
Two other comments: 1. Updated the linked CL so you can just look at the ...
9 years ago (2011-12-02 23:07:23 UTC) #23
enal1
On 2011/12/02 23:07:23, Victoria Kirst wrote: > Two other comments: > > 1. Updated the ...
9 years ago (2011-12-13 18:49:25 UTC) #24
acolwell GONE FROM CHROMIUM
On 2011/12/13 18:49:25, enal1 wrote: > On 2011/12/02 23:07:23, Victoria Kirst wrote: > > Two ...
9 years ago (2011-12-13 20:18:49 UTC) #25
no longer working on chromium
On Tue, Dec 13, 2011 at 9:18 PM, <acolwell@chromium.org> wrote: > >> >> I propose ...
9 years ago (2011-12-13 22:06:30 UTC) #26
enal1
Let me look what we can do easily. On Tue, Dec 13, 2011 at 2:06 ...
9 years ago (2011-12-13 22:07:35 UTC) #27
Chris Rogers
Aaron's proposal about temporarily renaming AudioRendererImpl to AudioRendererImpl2 seems reasonable at this stage. But I ...
9 years ago (2011-12-13 22:49:12 UTC) #28
no longer working on chromium
On Tue, Dec 13, 2011 at 7:49 PM, <enal@google.com> wrote: > On 2011/12/02 23:07:23, Victoria ...
9 years ago (2011-12-14 13:19:26 UTC) #29
enal1
Guys, I believe I fixed all timing-related issues. Now http://www.corp.google.com/~tommi/average.html again plays regularly and in ...
9 years ago (2011-12-14 17:55:29 UTC) #30
no longer working on chromium
Eugene, good work, we should push the CL out ASAP, I am working on the ...
9 years ago (2011-12-14 19:00:52 UTC) #31
enal1
Thank you for pointing. Code was zeroing out not the reminder but the entire buffer. ...
9 years ago (2011-12-14 19:10:14 UTC) #32
no longer working on chromium
> > >> > There are at least 4 issues with that CL: > * ...
9 years ago (2011-12-14 19:11:54 UTC) #33
no longer working on chromium
Great, please write down what kind of manual tests you need to pass on the ...
9 years ago (2011-12-14 19:16:29 UTC) #34
enal1
Will do. I am also planning to add automatic test. It cannot verify that it ...
9 years ago (2011-12-14 19:31:35 UTC) #35
enal1
Audio device calls RenderCallback() on startup to pre-populate the buffer, and then it calls in ...
9 years ago (2011-12-14 19:45:00 UTC) #36
no longer working on chromium
OK, then the concern is actually not on the race, but more on the per-buffering ...
9 years ago (2011-12-14 20:47:01 UTC) #37
Chris Rogers
On Wed, Dec 14, 2011 at 12:43 PM, Shijing Xian <xians@chromium.org> wrote: > > OK, ...
9 years ago (2011-12-14 20:51:28 UTC) #38
enal1
DoPlay() can be called lot of times on the same AudioDevice, and the buffer may ...
9 years ago (2011-12-14 20:53:53 UTC) #39
enal1
So I'll get rid of pre-population and send modified CL. On Wed, Dec 14, 2011 ...
9 years ago (2011-12-14 21:05:26 UTC) #40
no longer working on chromium
Thanks Chris for the clarification. Then the only reason for this pre-buffer is likely because ...
9 years ago (2011-12-14 21:08:23 UTC) #41
Chris Rogers
On Wed, Dec 14, 2011 at 1:08 PM, Shijing Xian <xians@chromium.org> wrote: > > Thanks ...
9 years ago (2011-12-15 00:41:42 UTC) #42
vrk (LEFT CHROMIUM)
I was out of office a few days and missed this discussion! Could I get ...
9 years ago (2011-12-15 01:55:15 UTC) #43
enal1
Yes, Victoria, you correctly summarized current situation. On Wed, Dec 14, 2011 at 5:55 PM, ...
9 years ago (2011-12-15 02:18:57 UTC) #44
enal1
9 years ago (2011-12-15 02:31:10 UTC) #45
We have all platforms yield on startup, it works on "normal" thread,
not in time-critical callback. Actually, there are 2 different places
in the code -- for 1st buffer I could schedule delayed callback if
data is not ready yet, so we are not burning extra cycles or blocking
message loop. For the 2nd/3rd buffers I had to use sleep(), it is
almost impossible to use message loop there. Those sleep() calls are
not in the callbacks either.

We have Windows-only yield() inside a callback for all buffers, but on
Windows callback is called by one of the worker threads in the process
thread pool, not by anything time-critical. That helps on a very slow
single-core systems running XP (I am using my 9-years old notebook for
testing).

On Wed, Dec 14, 2011 at 4:41 PM, Chris Rogers <crogers@google.com> wrote:
>
>
> On Wed, Dec 14, 2011 at 1:08 PM, Shijing Xian <xians@chromium.org> wrote:
>>
>>
>> Thanks Chris for the clarification. Then the only reason for this
>> pre-buffer is likely because
>> OnMoreData() reads the share_memory before sending a signal to
>> sync_socket, so it needs
>> to be some data in the share_memory, otherwise sync_reader::Read() will
>> yield.
>
>
> I think that was the intention - as long as we only yield on the very first
> time.  I remember we had problems where Yield() was being called *every*
> time OnMoreData() was called in certain cases.  We have to be super careful
> that doesn't ever happen.  I'm not even a big fan of the approach of using
> Yield() on the first time, but...
>
>>
>>
>>
>> On Wed, Dec 14, 2011 at 9:53 PM, Eugene Nalimov <enal@google.com> wrote:
>>>
>>> DoPlay() can be called lot of times on the same AudioDevice, and the
>>> buffer may keep its state from the previous playback. So we are asking
>>> for fresh data here.
>>>
>>> If you want to work on some CL, can you please get rid of
>>> double-closing the socket handle? It is very annoying to debug now...
>>>
>>
>> It has been ongoing, using shutdown(socket_handle_) solves all the
>> problems for linux and mac.
>> And Tommi is taking a look at windows. What I heard last time was that he
>> had some problem
>> on XP. But I believe he will soon have the CL out.
>>
>> BR,
>> /SX
>>
>

Powered by Google App Engine
This is Rietveld 408576698