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

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

Issue 2929823002: Making AudioManagerBase::ShutdownOnAudioThread() platform-agnostic (Closed)
Patch Set: moving closing streams to AudioManagerMac Created 3 years, 5 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/audio_manager_base.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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() {
« no previous file with comments | « media/audio/audio_manager_base.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698