Index: media/audio/mac/audio_auhal_mac.cc |
diff --git a/media/audio/mac/audio_auhal_mac.cc b/media/audio/mac/audio_auhal_mac.cc |
index 4d0d61430f15bd7f13e3ca0905c7065163d68286..6a876b6404cd0fd41c5c6f4a0c5446cb6263de7e 100644 |
--- a/media/audio/mac/audio_auhal_mac.cc |
+++ b/media/audio/mac/audio_auhal_mac.cc |
@@ -72,6 +72,7 @@ AUHALStream::AUHALStream( |
volume_(1), |
hardware_latency_frames_(0), |
stopped_(false), |
+ notified_for_possible_device_change_(false), |
input_buffer_list_(NULL) { |
// We must have a manager. |
DCHECK(manager_); |
@@ -159,6 +160,7 @@ void AUHALStream::Start(AudioSourceCallback* callback) { |
} |
stopped_ = false; |
+ notified_for_possible_device_change_ = false; |
{ |
base::AutoLock auto_lock(source_lock_); |
source_ = callback; |
@@ -209,6 +211,16 @@ OSStatus AUHALStream::Render( |
// In this case either audio input or audio output will be broken, |
// so just output silence. |
ZeroBufferList(io_data); |
+ |
+ // In case we missed a device notification, notify the AudioManager that the |
+ // device has changed. HandleDeviceChanges() will check to make sure the |
+ // device has actually changed before taking any action. |
+ if (!notified_for_possible_device_change_) { |
+ notified_for_possible_device_change_ = true; |
+ manager_->GetMessageLoop()->PostTask(FROM_HERE, base::Bind( |
+ &AudioManagerMac::HandleDeviceChanges, base::Unretained(manager_))); |
+ } |
+ |
return noErr; |
} |