Chromium Code Reviews| 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..ed3b193416712945ff0a3f56e8291f7718845435 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 AudioManager |
| + if (!notified_for_possible_device_change_) { |
| + // We should really be using TryPostTask here since we don't want to lock, |
|
Chris Rogers
2013/06/20 19:13:19
This codepath is never happening in normal steady-
DaleCurtis
2013/06/20 19:25:30
Correct, it's a one time thing too, so you're righ
|
| + // but MessageLoopProxy doesn't expose this, only MessageLoop. |
| + notified_for_possible_device_change_ = true; |
| + manager_->GetMessageLoop()->PostTask(FROM_HERE, base::Bind( |
| + &AudioManagerMac::HandleDeviceChanges, base::Unretained(manager_))); |
| + } |
| + |
| return noErr; |
| } |