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

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

Issue 2133703002: Fixes crash in AudioManagerMac at shutdown (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Improved comment Created 4 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 | « 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_manager_mac.cc
diff --git a/media/audio/mac/audio_manager_mac.cc b/media/audio/mac/audio_manager_mac.cc
index cbcd5edefecea52b958ec0edfdeed507838b1149..3f87c8e225a6764d97f0986585e7fbe4b3b933c1 100644
--- a/media/audio/mac/audio_manager_mac.cc
+++ b/media/audio/mac/audio_manager_mac.cc
@@ -387,10 +387,13 @@ AudioManagerMac::~AudioManagerMac() {
// We have seen cases where active input audio is not closed down properly
// at browser shutdown. AudioInputController::Close() is called but tasks
// in AudioInputController::DoClose() are not executed. Hence, input streams
- // might remain even at this late state.
+ // might remain even at this late state. |low_latency_input_streams_| will be
+ // modified during the call to stream->Close(), so we can't iterate over it
+ // here. Instead iterate over a copy.
// TODO(henrika): figure out the real cause why streams are not closed
// properly by the AIC for all cases and then remove this loop.
- for (auto* stream : low_latency_input_streams_) {
+ auto low_latency_input_streams_copy = low_latency_input_streams_;
+ for (auto* stream : low_latency_input_streams_copy) {
LOG(WARNING) << "Closing existing audio input stream at destruction";
// Prevents active Core Audio callbacks to use possibly invalid objects
// in its OnData() callback.
« 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