| Index: media/audio/audio_manager_base.cc
|
| diff --git a/media/audio/audio_manager_base.cc b/media/audio/audio_manager_base.cc
|
| index 52d545ea3f0b0d5b0513b711d8a0eb4e24a927af..fc6574c1ef857e8aaee4ce78b325188ad2e17bbf 100644
|
| --- a/media/audio/audio_manager_base.cc
|
| +++ b/media/audio/audio_manager_base.cc
|
| @@ -418,4 +418,32 @@ int AudioManagerBase::GetUserBufferSize() {
|
| return 0;
|
| }
|
|
|
| +void AudioManagerBase::FixWedgedAudio() {
|
| + DCHECK(message_loop_->BelongsToCurrentThread());
|
| +#if defined(OS_MACOSX)
|
| + // Through trial and error, we've found that one way to restore audio after a
|
| + // hang is to close all outstanding audio streams. Once all streams have been
|
| + // closed, new streams appear to work correctly.
|
| + //
|
| + // In Chrome terms, this means we need to ask all AudioOutputDispatchers to
|
| + // close all Open()'d streams. Once all streams across all dispatchers have
|
| + // been closed, we ask for all previously Start()'d streams to be recreated
|
| + // using the same AudioSourceCallback they had before.
|
| + //
|
| + // Since this operation takes place on the audio thread we can be sure that no
|
| + // other state-changing stream operations will take place while the fix is in
|
| + // progress.
|
| + //
|
| + // See http://crbug.com/160920 for additional details.
|
| + for (AudioOutputDispatchers::iterator it = output_dispatchers_.begin();
|
| + it != output_dispatchers_.end(); ++it) {
|
| + (*it)->dispatcher->CloseStreamsForWedgeFix();
|
| + }
|
| + for (AudioOutputDispatchers::iterator it = output_dispatchers_.begin();
|
| + it != output_dispatchers_.end(); ++it) {
|
| + (*it)->dispatcher->RestartStreamsForWedgeFix();
|
| + }
|
| +#endif
|
| +}
|
| +
|
| } // namespace media
|
|
|