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

Issue 11344005: Handle audio device changes on Mac (Closed)

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

Description

Handle audio device changes on Mac This is the Mac version of this Windows CL: https://codereview.chromium.org/11233023/ With this CL we now observer the default audio output device setting. When the setting changes we fire the AudioManagerMac::NotifyAllOutputDeviceChangeListeners notificaiton. This causes the output stream to be recreated and target the new default device. BUG=156788 TEST= Web Audio: Play audio from http://chromium.googlecode.com/svn/trunk/samples/audio/shiny-drum-machine.html Go to system preferences, change the default audio output device. Verify that audio is now playing for the new device. Flash Audio: Play a youtube video. Do the same as above.

Patch Set 1 #

Patch Set 2 : bind to right thread #

Total comments: 14

Patch Set 3 : address review comments #

Patch Set 4 : add thread check #

Total comments: 15

Patch Set 5 : address review comments #

Patch Set 6 : rebase #

Patch Set 7 : locking #

Total comments: 9

Patch Set 8 : address review comments #

Total comments: 18

Patch Set 9 : fix crash #

Total comments: 1

Patch Set 10 : address review comments #

Total comments: 6

Patch Set 11 : cleanup #

Patch Set 12 : " #

Unified diffs Side-by-side diffs Delta from patch set Stats (+204 lines, -5 lines) Patch
A media/audio/mac/audio_device_listener_mac.h View 1 2 3 4 5 6 7 8 9 1 chunk +39 lines, -0 lines 0 comments Download
A media/audio/mac/audio_device_listener_mac.cc View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +98 lines, -0 lines 0 comments Download
A media/audio/mac/audio_device_listener_mac_unittest.cc View 1 2 3 4 5 6 7 8 9 1 chunk +31 lines, -0 lines 0 comments Download
M media/audio/mac/audio_low_latency_output_mac.cc View 1 2 3 4 5 6 7 8 2 chunks +5 lines, -5 lines 0 comments Download
M media/audio/mac/audio_manager_mac.h View 1 2 3 4 5 2 chunks +10 lines, -0 lines 0 comments Download
M media/audio/mac/audio_manager_mac.cc View 1 2 3 4 5 4 chunks +18 lines, -0 lines 0 comments Download
M media/media.gyp View 5 2 chunks +3 lines, -0 lines 0 comments Download

Messages

Total messages: 28 (0 generated)
sail
8 years, 1 month ago (2012-10-28 23:30:26 UTC) #1
sail
8 years, 1 month ago (2012-10-28 23:56:04 UTC) #2
DaleCurtis
Nice work! I didn't know anyone was working on this!! In my local testing my ...
8 years, 1 month ago (2012-10-29 01:58:45 UTC) #3
sail
Thanks for the quick review! I've addressed all the review comments. I also found another ...
8 years, 1 month ago (2012-10-29 04:21:46 UTC) #4
Chris Rogers
haven't yet had a chance to look at the code, but it *is* necessary to ...
8 years, 1 month ago (2012-10-29 04:55:03 UTC) #5
DaleCurtis
On 2012/10/29 04:55:03, Chris Rogers wrote: > haven't yet had a chance to look at ...
8 years, 1 month ago (2012-10-29 05:33:10 UTC) #6
henrika (OOO until Aug 14)
Thanks for helping out Sailesh! I must also ask the obvious question. What happens for ...
8 years, 1 month ago (2012-10-29 08:44:07 UTC) #7
no longer working on chromium
I just took a quick look at the code, it seems to me that this ...
8 years, 1 month ago (2012-10-29 09:04:39 UTC) #8
henrika (OOO until Aug 14)
https://codereview.chromium.org/11344005/diff/2002/media/audio/mac/audio_device_listener_mac.h File media/audio/mac/audio_device_listener_mac.h (right): https://codereview.chromium.org/11344005/diff/2002/media/audio/mac/audio_device_listener_mac.h#newcode24 media/audio/mac/audio_device_listener_mac.h:24: // |listener_cb| must either outlive AudioDeviceListenerMac or the callback ...
8 years, 1 month ago (2012-10-29 09:20:36 UTC) #9
no longer working on chromium
On 2012/10/29 09:04:39, xians1 wrote: > I just took a quick look at the code, ...
8 years, 1 month ago (2012-10-29 09:29:01 UTC) #10
sail
https://codereview.chromium.org/11344005/diff/2002/media/audio/mac/audio_device_listener_mac.cc File media/audio/mac/audio_device_listener_mac.cc (right): https://codereview.chromium.org/11344005/diff/2002/media/audio/mac/audio_device_listener_mac.cc#newcode24 media/audio/mac/audio_device_listener_mac.cc:24: OSStatus OnDefaultDeviceChangedCallback( On 2012/10/29 08:44:07, henrika wrote: > static ...
8 years, 1 month ago (2012-10-29 20:37:39 UTC) #11
sail
Addressed all review comments. Also, AudioDeviceListenerMac is no longer ref counted. After rebasing to tip ...
8 years, 1 month ago (2012-10-29 20:39:03 UTC) #12
Scott Hess - ex-Googler
https://codereview.chromium.org/11344005/diff/5005/media/audio/mac/audio_device_listener_mac.cc File media/audio/mac/audio_device_listener_mac.cc (right): https://codereview.chromium.org/11344005/diff/5005/media/audio/mac/audio_device_listener_mac.cc#newcode58 media/audio/mac/audio_device_listener_mac.cc:58: base::AutoLock auto_lock(lock_); AFAICT, you have this lock to prevent ...
8 years, 1 month ago (2012-10-29 21:04:02 UTC) #13
DaleCurtis
http://codereview.chromium.org/11344005/diff/2002/media/audio/mac/audio_device_listener_mac.cc File media/audio/mac/audio_device_listener_mac.cc (right): http://codereview.chromium.org/11344005/diff/2002/media/audio/mac/audio_device_listener_mac.cc#newcode53 media/audio/mac/audio_device_listener_mac.cc:53: &OnDefaultDeviceChangedCallback, On 2012/10/29 08:44:07, henrika wrote: > Could you ...
8 years, 1 month ago (2012-10-29 21:11:32 UTC) #14
sail
http://codereview.chromium.org/11344005/diff/2002/media/audio/mac/audio_device_listener_mac.cc File media/audio/mac/audio_device_listener_mac.cc (right): http://codereview.chromium.org/11344005/diff/2002/media/audio/mac/audio_device_listener_mac.cc#newcode53 media/audio/mac/audio_device_listener_mac.cc:53: &OnDefaultDeviceChangedCallback, On 2012/10/29 21:11:32, DaleCurtis wrote: > On 2012/10/29 ...
8 years, 1 month ago (2012-10-29 21:38:26 UTC) #15
DaleCurtis
http://codereview.chromium.org/11344005/diff/2002/media/audio/mac/audio_device_listener_mac.cc File media/audio/mac/audio_device_listener_mac.cc (right): http://codereview.chromium.org/11344005/diff/2002/media/audio/mac/audio_device_listener_mac.cc#newcode53 media/audio/mac/audio_device_listener_mac.cc:53: &OnDefaultDeviceChangedCallback, On 2012/10/29 21:38:28, sail wrote: > On 2012/10/29 ...
8 years, 1 month ago (2012-10-29 21:57:14 UTC) #16
Scott Hess - ex-Googler
http://codereview.chromium.org/11344005/diff/5005/media/audio/mac/audio_device_listener_mac.cc File media/audio/mac/audio_device_listener_mac.cc (right): http://codereview.chromium.org/11344005/diff/5005/media/audio/mac/audio_device_listener_mac.cc#newcode58 media/audio/mac/audio_device_listener_mac.cc:58: base::AutoLock auto_lock(lock_); On 2012/10/29 21:57:14, DaleCurtis wrote: > You ...
8 years, 1 month ago (2012-10-29 22:19:21 UTC) #17
sail
Addressed review comments please take another look. Note, I had to change AUAudioOutputStream to use ...
8 years, 1 month ago (2012-10-29 23:08:07 UTC) #18
DaleCurtis
http://codereview.chromium.org/11344005/diff/8007/media/audio/mac/audio_device_listener_mac.cc File media/audio/mac/audio_device_listener_mac.cc (right): http://codereview.chromium.org/11344005/diff/8007/media/audio/mac/audio_device_listener_mac.cc#newcode21 media/audio/mac/audio_device_listener_mac.cc:21: std::vector<media::AudioDeviceListenerMac*>* g_listeners = NULL; This is going to cause ...
8 years, 1 month ago (2012-10-29 23:14:16 UTC) #19
sail
http://codereview.chromium.org/11344005/diff/8007/media/audio/mac/audio_device_listener_mac.cc File media/audio/mac/audio_device_listener_mac.cc (right): http://codereview.chromium.org/11344005/diff/8007/media/audio/mac/audio_device_listener_mac.cc#newcode21 media/audio/mac/audio_device_listener_mac.cc:21: std::vector<media::AudioDeviceListenerMac*>* g_listeners = NULL; On 2012/10/29 23:14:16, DaleCurtis wrote: ...
8 years, 1 month ago (2012-10-29 23:22:18 UTC) #20
sail
On 2012/10/29 23:22:18, sail wrote: > http://codereview.chromium.org/11344005/diff/8007/media/audio/mac/audio_device_listener_mac.cc > File media/audio/mac/audio_device_listener_mac.cc (right): > > http://codereview.chromium.org/11344005/diff/8007/media/audio/mac/audio_device_listener_mac.cc#newcode21 > ...
8 years, 1 month ago (2012-10-29 23:22:58 UTC) #21
Scott Hess - ex-Googler
http://codereview.chromium.org/11344005/diff/8007/media/audio/mac/audio_device_listener_mac.cc File media/audio/mac/audio_device_listener_mac.cc (right): http://codereview.chromium.org/11344005/diff/8007/media/audio/mac/audio_device_listener_mac.cc#newcode38 media/audio/mac/audio_device_listener_mac.cc:38: g_listeners->begin(); it != g_listeners->end(); ++it) { I think 'g' ...
8 years, 1 month ago (2012-10-29 23:31:49 UTC) #22
Chris Rogers
I agree with Dale that this is getting a bit too complicated. My feeling is ...
8 years, 1 month ago (2012-10-29 23:41:24 UTC) #23
Chris Rogers
and by "neutering" I mean clearing/resetting |listener_cb_| inside a lock
8 years, 1 month ago (2012-10-29 23:43:40 UTC) #24
sail
Moved to a singleton class.
8 years, 1 month ago (2012-10-29 23:49:47 UTC) #25
Scott Hess - ex-Googler
LGTM, the singleton side-steps the ordering issues. Does the media/audio/mac/audio_low_latency_output_mac.cc change belong?
8 years, 1 month ago (2012-10-29 23:58:36 UTC) #26
DaleCurtis
On 2012/10/29 23:58:36, shess wrote: > LGTM, the singleton side-steps the ordering issues. > > ...
8 years, 1 month ago (2012-10-30 00:08:30 UTC) #27
DaleCurtis
8 years, 1 month ago (2012-10-30 01:36:14 UTC) #28
On 2012/10/30 00:08:30, DaleCurtis wrote:
> On 2012/10/29 23:58:36, shess wrote:
> > LGTM, the singleton side-steps the ordering issues.
> > 
> > Does the media/audio/mac/audio_low_latency_output_mac.cc change belong?
> 
> Taking over from sail, will clean up and reupload under my name.

New CL here: http://codereview.chromium.org/11338024/

Powered by Google App Engine
This is Rietveld 408576698