summaryrefslogtreecommitdiffstats
path: root/media/audio/audio_output_resampler.cc
diff options
context:
space:
mode:
authordalecurtis@google.com <dalecurtis@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2013-12-04 00:45:47 +0000
committerdalecurtis@google.com <dalecurtis@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2013-12-04 00:45:47 +0000
commit2f8c23b482763d6c4060dc007389cfd6adc7490e (patch)
tree8ed7cb9d3da482df2af5eb4bfeaabcc539294155 /media/audio/audio_output_resampler.cc
parenteded43ded82a05127b0d2bdc4d388be1e3510719 (diff)
downloadchromium_src-2f8c23b482763d6c4060dc007389cfd6adc7490e.zip
chromium_src-2f8c23b482763d6c4060dc007389cfd6adc7490e.tar.gz
chromium_src-2f8c23b482763d6c4060dc007389cfd6adc7490e.tar.bz2
Attempt to fix audio wedges by restarting all streams on OSX.
Introduces two new methods to AudioOutputDispatcher: CloseStreamsForWedgeFix() and RestartStreamsForWedgeFix(). Respectively, each method closes or restarts all active streams owned by a given dispatcher. The process is completely transparent to upstream clients. A new method on AudioManager, FixWedgedAudio() calls CloseStreamsForWedgeFix() for all dispatchers and then calls RestartStreamsForWedgeFix() afterward. FixWedgedAudio() is called by each AudioOutputController when a wedge is detected. Multiple in flight wedge checks are serialized by the audio thread. The hope is that wedges will be fixed before the next WedgeCheck() fires. While the methods are available on all platforms, FixWedgedAudio() is only wired up on OSX. BUG=160920 TEST=unittest. fake wedge and observe stream recreation. R=scherkus@chromium.org Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=238325 Review URL: https://codereview.chromium.org/61203008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@238501 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media/audio/audio_output_resampler.cc')
-rw-r--r--media/audio/audio_output_resampler.cc24
1 files changed, 24 insertions, 0 deletions
diff --git a/media/audio/audio_output_resampler.cc b/media/audio/audio_output_resampler.cc
index 86b40dd..3179ddb 100644
--- a/media/audio/audio_output_resampler.cc
+++ b/media/audio/audio_output_resampler.cc
@@ -291,6 +291,30 @@ void AudioOutputResampler::Shutdown() {
DCHECK(callbacks_.empty());
}
+void AudioOutputResampler::CloseStreamsForWedgeFix() {
+ DCHECK(message_loop_->BelongsToCurrentThread());
+
+ // Stop and close all active streams. Once all streams across all dispatchers
+ // have been closed the AudioManager will call RestartStreamsForWedgeFix().
+ for (CallbackMap::iterator it = callbacks_.begin(); it != callbacks_.end();
+ ++it) {
+ dispatcher_->StopStream(it->first);
+ dispatcher_->CloseStream(it->first);
+ }
+
+ // Close all idle streams as well.
+ dispatcher_->CloseStreamsForWedgeFix();
+}
+
+void AudioOutputResampler::RestartStreamsForWedgeFix() {
+ DCHECK(message_loop_->BelongsToCurrentThread());
+ for (CallbackMap::iterator it = callbacks_.begin(); it != callbacks_.end();
+ ++it) {
+ dispatcher_->OpenStream();
+ dispatcher_->StartStream(it->second, it->first);
+ }
+}
+
OnMoreDataConverter::OnMoreDataConverter(const AudioParameters& input_params,
const AudioParameters& output_params)
: io_ratio_(static_cast<double>(input_params.GetBytesPerSecond()) /