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

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

Issue 1612943003: Shuts down input audio for long sequence of AudioUnitRender errors on Mac OSX (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nit Created 4 years, 11 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_low_latency_input_mac.cc
diff --git a/media/audio/mac/audio_low_latency_input_mac.cc b/media/audio/mac/audio_low_latency_input_mac.cc
index c034b61f9d1ee2627f18a2d2c85a3c9bd0267cc6..da84e95a2fb1bd9c2c1e6b50af08e786134b43e1 100644
--- a/media/audio/mac/audio_low_latency_input_mac.cc
+++ b/media/audio/mac/audio_low_latency_input_mac.cc
@@ -586,7 +586,8 @@ OSStatus AUAudioInputStream::InputProc(void* user_data,
if (result) {
UMA_HISTOGRAM_SPARSE_SLOWLY("Media.AudioInputCbErrorMac", result);
OSSTATUS_LOG(ERROR, result) << "AudioUnitRender() failed ";
- if (result == kAudioUnitErr_TooManyFramesToProcess) {
+ if (result == kAudioUnitErr_TooManyFramesToProcess ||
+ result == kAudioUnitErr_CannotDoInCurrentContext) {
DCHECK(!audio_input->last_success_time_.is_null());
// We delay stopping the stream for kAudioUnitErr_TooManyFramesToProcess
// since it has been observed that some USB headsets can cause this error
@@ -595,19 +596,19 @@ OSStatus AUAudioInputStream::InputProc(void* user_data,
// Instead, we measure time since last valid audio frame and call
// HandleError() only if a too long error sequence is detected. We do
// this to avoid ending up in a non recoverable bad core audio state.
+ // Also including kAudioUnitErr_CannotDoInCurrentContext since long
+ // sequences can be produced in combination with e.g. sample-rate changes
+ // for input devices.
base::TimeDelta time_since_last_success =
base::TimeTicks::Now() - audio_input->last_success_time_;
if ((time_since_last_success >
base::TimeDelta::FromSeconds(kMaxErrorTimeoutInSeconds))) {
- LOG(ERROR) << "Too long sequence of TooManyFramesToProcess errors!";
+ const char* err = (result == kAudioUnitErr_TooManyFramesToProcess)
+ ? "kAudioUnitErr_TooManyFramesToProcess"
+ : "kAudioUnitErr_CannotDoInCurrentContext";
+ LOG(ERROR) << "Too long sequence of " << err << " errors!";
audio_input->HandleError(result);
}
- } else if (result == kAudioUnitErr_CannotDoInCurrentContext) {
- // Returned when an audio unit is in a state where it can't perform the
- // requested action now - but it could later.
- // TODO(henrika): figure out why we see this error message; do nothing
- // for now. Hoping that we will get back on track soon.
- LOG(ERROR) << "kAudioUnitErr_CannotDoInCurrentContext";
} else {
// We have also seen kAudioUnitErr_NoConnection in some cases. Bailing
// out for this error for now.
« 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