Chromium Code Reviews| Index: media/audio/mac/audio_manager_mac.cc |
| diff --git a/media/audio/mac/audio_manager_mac.cc b/media/audio/mac/audio_manager_mac.cc |
| index 8478e0f70c56e5aded802dd0a8182f25dd605a35..ff66262a9cae2dfb3991ae6e555da140b259a668 100644 |
| --- a/media/audio/mac/audio_manager_mac.cc |
| +++ b/media/audio/mac/audio_manager_mac.cc |
| @@ -530,6 +530,26 @@ void AudioManagerMac::ShutdownOnAudioThread() { |
| // APIs and they can fail and disrupt tests during shutdown. |
| in_shutdown_ = true; |
| AudioManagerBase::ShutdownOnAudioThread(); |
|
alokp
2017/07/14 18:58:53
nit: May be release base class resources *after* l
|
| + |
| + // Even if tasks to close the streams are enqueued, they would not run |
| + // leading to CHECKs getting hit in the destructor about open streams. Close |
| + // them explicitly here. crbug.com/608049. |
| + for (auto iter = basic_input_streams_.begin(); |
| + iter != basic_input_streams_.end();) { |
| + // Note: Closing the stream will invalidate the iterator. |
| + // Increment the iterator before closing the stream. |
| + AudioInputStream* stream = *iter++; |
| + stream->Close(); |
| + } |
| + for (auto iter = low_latency_input_streams_.begin(); |
| + iter != low_latency_input_streams_.end();) { |
| + // Note: Closing the stream will invalidate the iterator. |
| + // Increment the iterator before closing the stream. |
| + AudioInputStream* stream = *iter++; |
| + stream->Close(); |
| + } |
| + CHECK(basic_input_streams_.empty()); |
| + CHECK(low_latency_input_streams_.empty()); |
| } |
| bool AudioManagerMac::HasAudioOutputDevices() { |