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

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

Issue 17463009: Try not to let the AUHAL driver get stuck sending silence. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Modify comments. Created 7 years, 6 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 | « media/audio/mac/audio_auhal_mac.h ('k') | media/audio/mac/audio_manager_mac.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
}
« no previous file with comments | « media/audio/mac/audio_auhal_mac.h ('k') | media/audio/mac/audio_manager_mac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698