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

Unified Diff: media/audio/mac/audio_manager_mac.cc

Issue 187693006: Always PostTask device change notifications. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rietveld!!! Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/audio/mac/audio_manager_mac.cc
diff --git a/media/audio/mac/audio_manager_mac.cc b/media/audio/mac/audio_manager_mac.cc
index 79ebe609ea9f4daba77e89c0dcc4354e5bb3c0e5..c24e9a50d45c5e61d38881f07a63124304a63e9b 100644
--- a/media/audio/mac/audio_manager_mac.cc
+++ b/media/audio/mac/audio_manager_mac.cc
@@ -566,8 +566,9 @@ AudioOutputStream* AudioManagerMac::MakeLowLatencyOutputStream(
// Lazily create the audio device listener on the first stream creation.
if (!output_device_listener_) {
- output_device_listener_.reset(new AudioDeviceListenerMac(base::Bind(
- &AudioManagerMac::HandleDeviceChanges, base::Unretained(this))));
+ output_device_listener_.reset(
wolenetz 2014/03/06 16:01:42 nit: add comment about why BTCL is required here v
DaleCurtis 2014/03/06 19:27:37 Done.
+ new AudioDeviceListenerMac(BindToCurrentLoop(base::Bind(
wolenetz 2014/03/06 16:01:42 I'm not too familiar with audio pipeline. Is it po
DaleCurtis 2014/03/06 19:27:37 No, in most cases AM shutdown blocks on the audio
+ &AudioManagerMac::HandleDeviceChanges, base::Unretained(this)))));
// Only set the current output device for the default device.
if (device_id == AudioManagerBase::kDefaultDeviceId || device_id.empty())
current_output_device_ = device;
@@ -698,13 +699,8 @@ void AudioManagerMac::ShutdownOnAudioThread() {
}
void AudioManagerMac::HandleDeviceChanges() {
- if (!GetTaskRunner()->BelongsToCurrentThread()) {
- GetTaskRunner()->PostTask(FROM_HERE, base::Bind(
- &AudioManagerMac::HandleDeviceChanges, base::Unretained(this)));
- return;
- }
-
- int new_sample_rate = HardwareSampleRate();
+ DCHECK(GetTaskRunner()->BelongsToCurrentThread());
+ const int new_sample_rate = HardwareSampleRate();
AudioDeviceID new_output_device;
GetDefaultOutputDevice(&new_output_device);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698