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

Issue 10909185: Add Mac OS X synchronized audio I/O back-end (Closed)

Created:
8 years, 3 months ago by Chris Rogers
Modified:
8 years, 3 months ago
CC:
chromium-reviews, feature-media-reviews_chromium.org
Visibility:
Public.

Description

Add Mac OS X synchronized audio I/O back-end AudioSynchronizedStream is an implementation of AudioOuputStream for Mac OS X when using an input and output which are *not* unified in the same driver. This requires managing a separate input and output thread for each of the drivers and synchronizing them with a FIFO and varispeed. This synchronization involves two threads, and requires that the FIFO be made thread-safe in the sense that one thread may call AudioFifo::Push() while a second thread calls AudioFifo::Consume(). It is not acceptable to simply require the client to put locks around these calls because they can (and will) be contended (causing glitches) since both threads are real-time audio threads. BUG=none TEST=extensive manual testing on various machines, audio hardware, and input/output sample-rates R=scherkus Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=157251

Patch Set 1 #

Total comments: 98

Patch Set 2 : #

Patch Set 3 : #

Patch Set 4 : #

Total comments: 25

Patch Set 5 : #

Total comments: 36

Patch Set 6 : #

Patch Set 7 : #

Patch Set 8 : #

Total comments: 10

Patch Set 9 : #

Patch Set 10 : #

Patch Set 11 : #

Patch Set 12 : #

Total comments: 7
Unified diffs Side-by-side diffs Delta from patch set Stats (+1303 lines, -20 lines) Patch
M media/audio/audio_output_resampler.h View 1 2 3 4 5 6 7 1 chunk +4 lines, -1 line 0 comments Download
M media/audio/audio_output_resampler.cc View 1 2 3 4 5 6 7 3 chunks +11 lines, -6 lines 0 comments Download
M media/audio/mac/audio_manager_mac.cc View 1 2 3 4 5 10 4 chunks +57 lines, -0 lines 4 comments Download
A media/audio/mac/audio_synchronized_mac.h View 1 2 3 4 5 1 chunk +210 lines, -0 lines 0 comments Download
A media/audio/mac/audio_synchronized_mac.cc View 1 2 3 4 5 6 7 8 1 chunk +945 lines, -0 lines 2 comments Download
M media/base/audio_bus.h View 1 2 3 4 5 6 7 8 9 4 chunks +11 lines, -0 lines 0 comments Download
M media/base/audio_bus.cc View 1 2 3 4 5 6 7 8 9 6 chunks +31 lines, -3 lines 0 comments Download
M media/base/audio_fifo.h View 1 2 3 4 5 4 chunks +7 lines, -3 lines 0 comments Download
M media/base/audio_fifo.cc View 1 2 3 4 5 6 7 8 9 10 11 5 chunks +25 lines, -7 lines 1 comment Download
M media/media.gyp View 1 2 3 4 5 1 chunk +2 lines, -0 lines 0 comments Download

Messages

Total messages: 22 (0 generated)
Chris Rogers
Please take a look. I'm still working on the details of calling OnMoreIOData(), etc. But ...
8 years, 3 months ago (2012-09-12 01:38:51 UTC) #1
no longer working on chromium
my first run. https://chromiumcodereview.appspot.com/10909185/diff/1/media/audio/mac/audio_synchronized_mac.cc File media/audio/mac/audio_synchronized_mac.cc (right): https://chromiumcodereview.appspot.com/10909185/diff/1/media/audio/mac/audio_synchronized_mac.cc#newcode19 media/audio/mac/audio_synchronized_mac.cc:19: const int kHardwareBufferSize = 128; put ...
8 years, 3 months ago (2012-09-12 09:11:56 UTC) #2
scherkus (not reviewing)
cool stuff -- here's my initial pass don't forget the .gyp changes! https://chromiumcodereview.appspot.com/10909185/diff/1/media/audio/mac/audio_synchronized_mac.cc File media/audio/mac/audio_synchronized_mac.cc ...
8 years, 3 months ago (2012-09-12 14:05:27 UTC) #3
Chris Rogers
PTAL, this still isn't perfect, but I've addressed nearly all the comments. And it works! ...
8 years, 3 months ago (2012-09-13 01:03:05 UTC) #4
scherkus (not reviewing)
http://codereview.chromium.org/10909185/diff/1005/media/audio/mac/audio_synchronized_mac.cc File media/audio/mac/audio_synchronized_mac.cc (right): http://codereview.chromium.org/10909185/diff/1005/media/audio/mac/audio_synchronized_mac.cc#newcode211 media/audio/mac/audio_synchronized_mac.cc:211: // implement - or remove SetVolume()/GetVolume() from AudioOutputStream. nit: ...
8 years, 3 months ago (2012-09-13 13:06:03 UTC) #5
DaleCurtis
http://codereview.chromium.org/10909185/diff/1005/media/base/audio_bus.h File media/base/audio_bus.h (right): http://codereview.chromium.org/10909185/diff/1005/media/base/audio_bus.h#newcode40 media/base/audio_bus.h:40: ~AudioBus(); On 2012/09/13 13:06:03, scherkus wrote: > we'll likely ...
8 years, 3 months ago (2012-09-14 09:14:00 UTC) #6
Chris Rogers
PTAL kbr, jbauman: Please review AudioFifo changes for thread safety scherkus, dalecurtis: I still haven't ...
8 years, 3 months ago (2012-09-15 00:06:08 UTC) #7
jbauman
http://codereview.chromium.org/10909185/diff/10004/media/base/audio_fifo.cc File media/base/audio_fifo.cc (right): http://codereview.chromium.org/10909185/diff/10004/media/base/audio_fifo.cc#newcode85 media/base/audio_fifo.cc:85: NoBarrier_AtomicExchange(&frames_pushed_, new_frames_pushed); This (and the next one) should be ...
8 years, 3 months ago (2012-09-15 00:33:52 UTC) #8
DaleCurtis
http://codereview.chromium.org/10909185/diff/1005/media/base/audio_bus.h File media/base/audio_bus.h (right): http://codereview.chromium.org/10909185/diff/1005/media/base/audio_bus.h#newcode40 media/base/audio_bus.h:40: ~AudioBus(); On 2012/09/15 00:06:08, Chris Rogers wrote: > On ...
8 years, 3 months ago (2012-09-15 07:44:42 UTC) #9
no longer working on chromium
I am going to defer my parts to Andrew and Dale, hope it is fine. ...
8 years, 3 months ago (2012-09-17 08:26:01 UTC) #10
scherkus (not reviewing)
http://codereview.chromium.org/10909185/diff/10004/media/audio/mac/audio_manager_mac.cc File media/audio/mac/audio_manager_mac.cc (right): http://codereview.chromium.org/10909185/diff/10004/media/audio/mac/audio_manager_mac.cc#newcode265 media/audio/mac/audio_manager_mac.cc:265: } else { nit: else not needed http://codereview.chromium.org/10909185/diff/10004/media/audio/mac/audio_synchronized_mac.cc File ...
8 years, 3 months ago (2012-09-17 14:51:17 UTC) #11
Chris Rogers
PTAL: I've added in the correct logic to AudioManagerMac, and reduced the changes to AudioBus ...
8 years, 3 months ago (2012-09-17 20:44:23 UTC) #12
no longer working on chromium
Please address my comments. In case you are able to make it for M23, you ...
8 years, 3 months ago (2012-09-17 20:47:46 UTC) #13
DaleCurtis
http://codereview.chromium.org/10909185/diff/6011/media/audio/audio_output_resampler.cc File media/audio/audio_output_resampler.cc (right): http://codereview.chromium.org/10909185/diff/6011/media/audio/audio_output_resampler.cc#newcode289 media/audio/audio_output_resampler.cc:289: SourceIOCallback_Locked(NULL, dest); As mentioned on chat, I feel like ...
8 years, 3 months ago (2012-09-17 21:17:36 UTC) #14
Chris Rogers
PTAL xians: I've addressed your comments, except where I've made a note http://codereview.chromium.org/10909185/diff/10004/media/audio/mac/audio_synchronized_mac.cc File media/audio/mac/audio_synchronized_mac.cc ...
8 years, 3 months ago (2012-09-17 22:00:42 UTC) #15
jbauman
On 2012/09/17 20:44:23, Chris Rogers wrote: > http://codereview.chromium.org/10909185/diff/10004/media/base/audio_fifo.h > File media/base/audio_fifo.h (right): > > http://codereview.chromium.org/10909185/diff/10004/media/base/audio_fifo.h#newcode41 ...
8 years, 3 months ago (2012-09-17 22:11:03 UTC) #16
Chris Rogers
PTAL jbauman: I've moved the MemoryBarrier to after computing the delta. dalecurtis: I've added |can_set_channel_data_| ...
8 years, 3 months ago (2012-09-17 22:30:55 UTC) #17
Chris Rogers
Fixed minor Windows compile error relating to namespace of MemoryBarrier()
8 years, 3 months ago (2012-09-17 22:56:55 UTC) #18
scherkus (not reviewing)
lgtm w/ nits http://codereview.chromium.org/10909185/diff/11018/media/audio/mac/audio_manager_mac.cc File media/audio/mac/audio_manager_mac.cc (right): http://codereview.chromium.org/10909185/diff/11018/media/audio/mac/audio_manager_mac.cc#newcode46 media/audio/mac/audio_manager_mac.cc:46: // Returns if the default input ...
8 years, 3 months ago (2012-09-17 23:07:17 UTC) #19
DaleCurtis
audio_bus parts lgtm.
8 years, 3 months ago (2012-09-17 23:56:47 UTC) #20
Chris Rogers
Thanks! Andrew, I addressed your last comments on commit. https://chromiumcodereview.appspot.com/10909185/diff/11018/media/audio/mac/audio_manager_mac.cc File media/audio/mac/audio_manager_mac.cc (right): https://chromiumcodereview.appspot.com/10909185/diff/11018/media/audio/mac/audio_manager_mac.cc#newcode46 media/audio/mac/audio_manager_mac.cc:46: ...
8 years, 3 months ago (2012-09-18 00:22:36 UTC) #21
jbauman
8 years, 3 months ago (2012-09-18 00:26:57 UTC) #22
http://codereview.chromium.org/10909185/diff/11018/media/base/audio_fifo.cc
File media/base/audio_fifo.cc (right):

http://codereview.chromium.org/10909185/diff/11018/media/base/audio_fifo.cc#n...
media/base/audio_fifo.cc:129: }
Could you make sure to put another memory barrier here? It'll ensure the
producer won't overwrite data in the buffer that hasn't quite been consumed yet.

Powered by Google App Engine
This is Rietveld 408576698